LOG121_TP01/src/view/Environment.java
2022-06-19 21:17:41 -04:00

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;
}
}