public final class Animator
extends java.lang.Object
implements java.awt.event.ActionListener
Constructor and Description |
---|
Animator(Animation animation,
int framesPerSecond)
Constructs an Animator for the given animation and frame rate.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Implements the ActionListener interface used by the Timer.
|
Animation |
animation()
Returns the animator's animation.
|
long |
elapsedTime()
Returns the elapsed time since animation start.
|
int |
framesPerSecond()
Returns the desired frame rate.
|
void |
start()
Starts the animator and in turn the animation.
|
void |
stop()
Stops the animator.
|
java.lang.String |
toString()
Returns a string representation for the animator.
|
public Animator(Animation animation, int framesPerSecond)
animation
- the animation to animateframesPerSecond
- the desired frame ratejava.lang.NullPointerException
- if the animation is null
java.lang.IllegalArgumentException
- if the frame rate is non-positivepublic Animation animation()
public int framesPerSecond()
public long elapsedTime()
public void start()
public void stop()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the action eventpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2011 JGoodies Karsten Lentzsch. All Rights Reserved.