public final class Animator extends Object implements 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(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.
|
String |
toString()
Returns a string representation for the animator.
|
public Animator(Animation animation, int framesPerSecond)
animation
- the animation to animateframesPerSecond
- the desired frame rateNullPointerException
- if the animation is null
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(ActionEvent e)
actionPerformed
in interface ActionListener
e
- the action eventCopyright © 2015 JGoodies Software GmbH. All rights reserved.