Package com.ms.util |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class Timer { // Constructors public Timer(long p) public Timer(long p, int id) public Timer(long p, boolean r) public Timer(long p, int id, boolean r) public Timer(TimerListener defaultListener, long p) public Timer(TimerListener defaultListener, long p, int id) public Timer(TimerListener defaultListener, long p, boolean r) public Timer(TimerListener defaultListener, long p, int id, boolean r) // Methods public long getPeriod() public boolean getRepeat() public int getUserID() public synchronized void addTimerListener(TimerListener listener) public synchronized void removeTimerListener(TimerListener listener) public synchronized boolean isRunning() public synchronized void start() public synchronized void stop() }
Implements a timer event source.
public Timer(long p)Constructs a one-shot timer with the specified period.
Parameter Description p The initial period of the timer.
public Timer(long p, int id)Constructs a one-shot timer with a specific period and user-defined identifier.
Parameter Description p The initial period of the timer. id The user-defined identifier for the timer.
public Timer(long p, boolean r)Constructs a one-shot or repeating timer with the specified periond.
Parameter Description p The initial period of the timer. r Specifies whether the timer is repeating (vs. one-shot).
public Timer(long p, int id, boolean r)Constructs a one-shot or repeating timer with the specified period.
Parameter Description p The initial period of the timer. id The user-defined identifier for the timer. r Specifies whether the timer is repeating (vs. one-shot).
public Timer(TimerListener defaultListener, long p)Constructs a one-shot timer with the specified period and initial listener.
Parameter Description defaultListener An initial listener to add to the timer. p The initial period of the timer.
public Timer(TimerListener defaultListener, long p, int id)Constructs a one-shot timer with the specified period and initial listener.
Parameter Description defaultListener An initial listener to add to the timer. p The initial period of the timer. id The user-defined identifier for the timer.
public Timer(TimerListener defaultListener, long p, boolean r)Constructs a one-shot or repeating timer with the specified period and initial listener.
Parameter Description defaultListener An initial listener to add to the timer. p The initial period of the timer. r Specifies whether the timer is repeating (vs. one-shot).
public Timer(TimerListener defaultListener, long p, int id, boolean r)Constructs a one-shot or repeating timer with the specified period and initial listener.
Parameter Description defaultListener An initial listener to add to the timer. p The initial period of the timer. r Specifies whether the timer is repeating (vs. one-shot).
public synchronized void addTimerListener(TimerListener listener)Adds the specified listener to the timer.
Parameter Description listener The listener to add.
public long getPeriod()Retrieves the period of the timer.
Return Value:
Returns the number of milliseconds that must elapse before the timer fires.
public boolean getRepeat()Retrieves the repeat flag for the timer.
Return Value:
Returns true if the timer is a repeating timer, flase if one-shot.
public int getUserID()Retrieves the user-defined id associated with the timer.
Return Value:
Returns the integer identifier of the timer.
public synchronized boolean isRunning()Queries the run status of the timer.
Return Value:
Returns true if the timer is currently running, false otherwise.
public synchronized void removeTimerListener(TimerListener listener)Removes the specified listener from the timer. This method prevents future timer events from being generated for the listener. Timer events which have already been generated may still be delivered.
Parameter Description listener The listener to remove.
public synchronized void start()(re)Starts the timer. If the timer is already running, calls to this method are ignored.
public synchronized void stop()Stops the timer. This method prevents future timer events from being generated. Timer events which have already been generated may still be delivered to listeners. If the timer is not presently running, calls to this method are ignored.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.