michael.heinrichs at oracle.com
Tue Mar 6 02:56:33 PST 2012
I think you can either use a standard Timer or a Timeline with a single KeyFrame and cycleCount INDEFINITE. Your logic needs to go into the onFinished handler. There is a property in Timeline to set an initial delay.
On 06.03.2012, at 11:44, Tom Eugelink wrote:
> 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