public class Timer extends Object
Constructor and Description |
---|
Timer(String name,
long delay,
ActionListener listener)
Creates a new Timer.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener)
Adds an ActionListener to invoke at timer expirations.
|
long |
clearReset()
Gets the time of the last reset, then clears the indication of the reset.
|
Date |
getLastActivation()
Returns the time of the last timer expiration.
|
Date |
getNextActivation()
Returns the time of the next timer expiration.
|
void |
removeActionListener(ActionListener listener)
Removes the given ActionListener so that it will no longer be invoked.
|
void |
reset()
Resets this Timer.
|
void |
start()
Starts this Timer immediately.
|
void |
start(long initialDelay)
Starts this Timer with an initial delay.
|
void |
stop()
Stops this Timer.
|
public Timer(String name, long delay, ActionListener listener)
name
- the name for this Timer's daemon thread.delay
- the delay between successive timer expirations, in ms.listener
- the ActionListener to invoke at timer expirations.public void addActionListener(ActionListener listener)
listener
- the ActionListener to add.public void removeActionListener(ActionListener listener)
listener
- the ActionListener to remove.public void start()
public void start(long initialDelay)
initialDelay
- the delay before first timer expiration, in ms.public void stop()
public void reset()
public long clearReset()
public Date getLastActivation()
public Date getNextActivation()
Copyright © 2023. All rights reserved.