void (boolean active) { boolean wasActive = myIsActive.getAndSet(active); if (active && !wasActive) { myTimer.set(new Timer(TICK_DELAY_MS, actionEvent -> tick())); myTimer.get().setRepeats(true); myTimer.get().start(); reset(); } else if (!active && wasActive) { myTimer.get().stop(); myTimer.set(null); // clear the FPS bar requestFpsBarRepaint(); } }