public class Timer
extends java.lang.Thread
This class implements a simple timer. Every time the timer clock cycle that is specified expires the TimerEvent method on the given TimerListener object will be invoked. This gives the object a chance to perform some type of timeout checking.
构造器和说明 |
---|
Timer(TimerListener timerListener,
int cycle)
Constructs a new Timer object
|
Timer(TimerListener timerListener,
int cycle,
java.lang.Object object)
Constructs a new Timer object
|
限定符和类型 | 方法和说明 |
---|---|
void |
run()
Runs the timer.
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public Timer(TimerListener timerListener, int cycle)
Constructs a new Timer object
timerListener
- Object that will receive TimerEvent
notificationscycle
- Number of seconds in each timer cyclepublic Timer(TimerListener timerListener, int cycle, java.lang.Object object)
Constructs a new Timer object
timerListener
- Object that will receive TimerEvent
notificationscycle
- Number of seconds in each timer cycleobject
- Object to be supplied with the TimerEvent
notification