|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectNGP.Timer
An object that "activates" at a specified interval. This class can be
used to help model both an "Animator" that might affect an entire program,
or a "Behavior" that might affect only an individual object. The
activate
method will fire every time a certain number
of milliseconds has passed. It is up to the subclass to override
activate
to determine what should take place.
This timer will not stop activating until the program ends or
stop
is called explicitly.
Constructor Summary | |
Timer(int delay)
Creates a Timer with a delay between
activate calls |
Method Summary | |
void |
actionPerformed(ActionEvent e)
Normal users need not deal with this method! |
abstract void |
activate()
Called whenever the set time has expired. |
int |
getDelay()
Return the number of milliseconds this Timer uses as a delay. |
void |
setDelay(int d)
Set the number of milliseconds this Timer uses as a delay. |
void |
start()
Start the timer, a timer is stopped by default. |
void |
stop()
Stop the timer, a timer is stopped by default. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Timer(int delay)
Timer
with a delay between
activate
calls
delay
- milliseconds between activate callsMethod Detail |
public void actionPerformed(ActionEvent e)
Called by the Swing Timer when the time has expired. It will then call
activate
which subclasses should override.
actionPerformed
in interface ActionListener
e
- the java.awt.event.ActionEvent that was sent, we do not deal
with itpublic abstract void activate()
public int getDelay()
setDelay
public void setDelay(int d)
d
- the number of milliseconds the Timer should use as a delaygetDelay
public void start()
stop
public void stop()
start
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |