- java.lang.Object
-
- javafx.animation.AnimationTimer
-
public abstract class AnimationTimer extends Object
The classAnimationTimer
allows to create a timer, that is called in each frame while it is active. An extending class has to override the methodhandle(long)
which will be called in every frame. The methodsstart()
andstop()
allow to start and stop the timer.- Since:
- JavaFX 2.0
-
-
Method Detail
-
handle
public abstract void handle(long now)
This method needs to be overridden by extending classes. It is going to be called in every frame while theAnimationTimer
is active.- Parameters:
now
- The timestamp of the current frame given in nanoseconds. This value will be the same for allAnimationTimers
called during one frame.
-
start
public void start()
Starts theAnimationTimer
. Once it is started, thehandle(long)
method of thisAnimationTimer
will be called in every frame. TheAnimationTimer
can be stopped by callingstop()
.
-
stop
public void stop()
Stops theAnimationTimer
. It can be activated again by callingstart()
.
-
-