package view; import javax.swing.*; public class Environment extends SwingWorker { 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; } }