Package com.jidesoft.swing
Class Animator
java.lang.Object
com.jidesoft.swing.Animator
- All Implemented Interfaces:
ActionListener
,EventListener
An
ActionListener
with a timer. It is used to simplify the animation of all kind of sliding windows.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Adds anAnimatorListener
to this Animator.protected Timer
createTimer
(int initDelay, int delay) protected Timer
createTimer
(int delay, ActionListener listener) Creates the timer.void
dispose()
Returns an array of all theAnimatorListener
s added to this Animator with addAnimatorListener().void
Interrupts the animator.boolean
If the animator is running, returns true.void
Removes anAnimatorListener
from this Animator.void
setDelay
(int delay) void
start()
Starts the animator.void
stop()
Stop the animator and reset the counter.
-
Field Details
-
_delay
protected int _delay -
_initialDelay
protected int _initialDelay
-
-
Constructor Details
-
Animator
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
Creates an animator for source.- Parameters:
source
- the source for this animator.initDelay
- the initial delay before timer starts.delay
- the delay of the timertotalSteps
- the number of steps. If -1, it means this animator will never stop untilstop()
is called.
-
-
Method Details
-
createTimer
-
createTimer
Creates the timer.- Parameters:
delay
- the delay between each step, in ms.listener
- the action listener associated with the timer.- Returns:
- the timer
-
addAnimatorListener
Adds anAnimatorListener
to this Animator.- Parameters:
l
- theAnimatorListener
to be added
-
removeAnimatorListener
Removes anAnimatorListener
from this Animator.- Parameters:
l
- the listener to be removed
-
getAnimatorListeners
Returns an array of all theAnimatorListener
s added to this Animator with addAnimatorListener().- Returns:
- all of the
AnimatorListener
s added or an empty array if no listeners have been added
-
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
-
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()
-