This is a quote from the AnimationTimer
class documentation.
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.
But I don't know how many frames are rendered each second, and when the handle method has been called ? before frame being rendered or after.
And is it bad idea to use too many AnimationTimer
in my application(Game)?
How many frames javafx renders depends on the complexity of your program. The cap is at approx. 60 frames per second, which is a common fps border for applications. The method is called prior to the frame being displayed (you can check that by simply putting a breakpoint into the method).
Actually, it is a common use for the AnimationTimer to count the frames per second. This blog entry explains a lot:
http://tbeernot.wordpress.com/2011/11/12/javafx-2-0-bubblemark/
The AnimationTimer can be used for a wide range of applications, not just for animations. If it is a good or bad idea to use for your specific application cannot be determined without seeing the code itself. but for usages of AnimationTimer, this is a good source to read:
http://blog.netopyr.com/2012/06/14/using-the-javafx-animationtimer/