22 lines
503 B
Java
22 lines
503 B
Java
package view;
|
|
|
|
import javax.swing.*;
|
|
|
|
public class Environment extends SwingWorker<Object, String> {
|
|
private static final int DELAY = 100;
|
|
public static final String TURN_PROPERTY_NAME = "turn";
|
|
|
|
private boolean active = true;
|
|
private long tick = 0L;
|
|
|
|
@Override
|
|
protected Object doInBackground() throws Exception {
|
|
while (active) {
|
|
Thread.sleep(DELAY);
|
|
|
|
firePropertyChange(TURN_PROPERTY_NAME, tick, ++tick);
|
|
}
|
|
return null;
|
|
}
|
|
}
|