tbee at tbee.org
Tue Mar 6 02:44:42 PST 2012
For the second time I'm in need of a timer logic, similar to Swing's timer class.
What I want to do is that when there is a mouse-pressed event, a timer is started with an initial delay of 500 ms or s,o and then it must repeat every 100 or 200 ms and increment a value. Real world: the user presses-and-holds the LMB over an arrow in the spinner control, and it must start incrementing; tak tak tak tak tak, maybe picking up speed or step size as the button is held.
There is AFAIK no timer class in JavaFX. There is an AnimationTimer, but that is closely linked to the repaint frequency, this usage should not be.
The other time I needed a timer, all I needed was a single delayed execution, so I abused the PauseTransition and the onFinished event. But now I need the repeating behavior and Animations do not have an onTrigger or something.
What is the best way to do a Swing like timer in JavaFX?
More information about the openjfx-dev