private void animate() { if (lastAnimationTime > targetTime) { removeTransitions(); animating = false; if (repeatAnimationCheckbox.isSelected()) { addAnimatedTransitions(); } } else { timeController.calculateCurrentTime(); lastAnimationTime = timeController.getCurrentTime(); diagramView.repaint(); // paint it again as time has past } }