All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----jp.kyasu.awt.Timer
Timer
object causes an action to occur at a predefined
rate. For example, an animation object can use a Timer as the trigger
for drawing its next frame. Each Timer has a list of ActionListeners and
a delay (the time between actionPerfomed() calls). When delay
milliseconds have passed, a Timer sends the actionPerformed()
message to its listeners. This cycle repeats until stop() is
called, or halts immediately if the Timer is configured to send its
message just once.
Using a Timer involves first creating it, then starting it using the start() method.
The API of this class is designed based on
com.sun.java.swing.Timer
in swing 0.5.1
,
but the implementation of this class is original.
true
if the timer is running.
true
if the timer will send a
actionPerformed()
message to its listeners multiple
times.
actionPerfomed()
messages to its listeners.
false
, instructs the timer
to send actionPerformed()
to its listeners only once,
and then stop.
actionPerformed()
messages to its listeners.
actionPerformed()
messages to its listeners.
public Timer(int delay, ActionListener listener)
public Timer(int initialDelay, int delay, ActionListener listener)
public synchronized void addActionListener(ActionListener l)
public synchronized void removeActionListener(ActionListener l)
public synchronized int getInitialDelay()
public synchronized void setInitialDelay(int initialDelay)
public synchronized int getDelay()
public synchronized void setDelay(int delay)
actionPerfomed()
messages to its listeners.
public synchronized boolean repeats()
true
if the timer will send a
actionPerformed()
message to its listeners multiple
times.
public synchronized void setRepeats(boolean flag)
false
, instructs the timer
to send actionPerformed()
to its listeners only once,
and then stop.
public synchronized boolean isRunning()
true
if the timer is running.
public synchronized void start()
actionPerformed()
messages to its listeners.
public synchronized void stop()
actionPerformed()
messages to its listeners.
public synchronized void restart()
All Packages Class Hierarchy This Package Previous Next Index