JIDE 3.5.15

com.jidesoft.swing
Class Animator

java.lang.Object
  extended by com.jidesoft.swing.Animator
All Implemented Interfaces:
ActionListener, EventListener

public class Animator
extends Object
implements ActionListener

An ActionListener with a timer. It is used to simplify the animation of all kind of sliding windows.


Constructor Summary
Animator(Component source)
          Creates an animator for source with initDelay 50 ms, each step delays 10 ms and total 10 steps.
Animator(Component source, int initDelay, int delay, int totalSteps)
          Creates an animator for source.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addAnimatorListener(AnimatorListener l)
          Adds an AnimatorListener to this Animator.
protected  Timer createTimer(int delay, ActionListener listener)
          Creates the timer.
 void dispose()
           
 AnimatorListener[] getAnimatorListeners()
          Returns an array of all the AnimatorListeners added to this Animator with addAnimatorListener().
 void interrupt()
          Interrupts the animator.
 boolean isRunning()
          If the animator is running, returns true.
 void removeAnimatorListener(AnimatorListener l)
          Removes an AnimatorListener from this Animator.
 void setDelay(int delay)
           
 void start()
          Starts the animator.
 void stop()
          Stop the animator and reset the counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Animator

public Animator(Component source)
Creates an animator for source with initDelay 50 ms, each step delays 10 ms and total 10 steps.

Parameters:
source - the source for this animator.

Animator

public Animator(Component source,
                int initDelay,
                int delay,
                int totalSteps)
Creates an animator for source.

Parameters:
source - the source for this animator.
initDelay - the initial delay before timer starts.
delay - the delay of the timer
totalSteps - the number of steps. If -1, it means this animator will never stop until stop() is called.
Method Detail

createTimer

protected Timer createTimer(int delay,
                            ActionListener listener)
Creates the timer.

Parameters:
delay - the delay between each step, in ms.
listener - the action listener associated with the timer.
Returns:
the timer

addAnimatorListener

public void addAnimatorListener(AnimatorListener l)
Adds an AnimatorListener to this Animator.

Parameters:
l - the AnimatorListener to be added

removeAnimatorListener

public void removeAnimatorListener(AnimatorListener l)
Removes an AnimatorListener from this Animator.

Parameters:
l - the listener to be removed

getAnimatorListeners

public AnimatorListener[] getAnimatorListeners()
Returns an array of all the AnimatorListeners added to this Animator with addAnimatorListener().

Returns:
all of the AnimatorListeners added or an empty array if no listeners have been added

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

start

public void start()
Starts the animator.


stop

public void stop()
Stop the animator and reset the counter.


interrupt

public void interrupt()
Interrupts the animator. The counter is not reset in this case.


isRunning

public boolean isRunning()
If the animator is running, returns true. Otherwise, returns false.

Returns:
true if animator is running. Otherwise, returns false.

setDelay

public void setDelay(int delay)

dispose

public void dispose()

JIDE 3.5.15