OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 181 → Rev 182

/trunk/OpenConcerto/src/org/openconcerto/ui/effect/Spots.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
31,6 → 31,10
 
public class Spots extends JComponent implements Runnable {
 
// Allow to disable (more than 10% CPU on x2go VM (java itself + x2goagent))
static public final String START_SLEEPING_PROP_NAME = Spots.class.getSimpleName() + ".startSleeping";
static final boolean START_SLEEPING = Boolean.getBoolean(START_SLEEPING_PROP_NAME);
 
static int width = 256;
static int height = 48;
 
68,8 → 72,9
 
private Image onScreenImage;
private MemoryImageSource imageSource;
private long sleeptime = DEFAULT_SLEEPTIME;
private long sleeptime;
private static final int DEFAULT_SLEEPTIME = 20;
private static final int STOP_SLEEPTIME = 60 * 60 * 1000;
 
public static void main(String[] args) {
JFrame f = new JFrame();
85,7 → 90,11
}
 
public Spots() {
this(START_SLEEPING, true);
}
 
public Spots(final boolean startSleeping, final boolean addMouseListener) {
this.sleeptime = startSleeping ? STOP_SLEEPTIME : DEFAULT_SLEEPTIME;
ga = true;
 
pixles = new int[width * height];
94,21 → 103,21
setPreferredSize(new Dimension(width, height));
setMinimumSize(new Dimension(width, height));
setMaximumSize(new Dimension(width, height));
if (addMouseListener) {
this.addMouseListener(new MouseAdapter() {
 
@Override
public void mouseClicked(MouseEvent e) {
 
if (sleeptime == DEFAULT_SLEEPTIME) {
// Redessine un fois par heure
sleeptime = 60 * 60 * 1000;
sleeptime = STOP_SLEEPTIME;
} else {
sleeptime = DEFAULT_SLEEPTIME;
updateThread.interrupt();
}
}
 
});
}
}
 
public void init() {
setBackground(Color.black);