javafx.animation
Class AnimationTimer
- javafx.animation.AnimationTimer
public abstract class AnimationTimer extends Object
The class
AnimationTimer allows to create a timer, that is called in each frame while it is active. An extending class has to override the method handle(long) which will be called in every frame. The methods start() and stop() allow to start and stop the timer.Since:
JavaFX 2.0
-
Constructor Summary
Constructors Constructor and Description AnimationTimer()Creates a new timer.
-
Method Summary
All MethodsInstance MethodsAbstract MethodsConcrete Methods Modifier and Type Method and Description abstract voidhandle(long now)This method needs to be overridden by extending classes.voidstart()Starts theAnimationTimers.voidstop()Stops theAnimationTimers.
-
Constructor Detail
-
AnimationTimer
public AnimationTimer()
Creates a new timer.
-
-
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 theAnimationTimeris active.Parameters:
now- The timestamp of the current frame given in nanoseconds. This value will be the same for allAnimationTimerscalled during one frame.
-
start
public void start()
Starts theAnimationTimers. Once it is started, thehandle(long)method of thisAnimationTimerswill be called in every frame. TheAnimationTimerscan be stopped by callingstop().
-
stop
public void stop()
Stops theAnimationTimers. It can be activated again by callingstart().
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.