public class SWTTimer extends Timer
Modifier and Type | Class and Description |
---|---|
(package private) class |
SWTTimer.SWTDoPostEvent
DoPostEvent is a runnable class that fires actionEvents to the listeners
on the EventDispatchThread, via invokeLater.
|
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
running |
listenerList
Constructor and Description |
---|
SWTTimer(org.eclipse.swt.widgets.Display display,
int delay,
ActionListener listener)
Constructor for SWTTimer.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
cancelEventOverride()
Resets the internal state to indicate this Timer shouldn't notify any of
its listeners.
|
protected void |
fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered interest for notification on
this event type.
|
int |
getDelay()
Returns the delay, in milliseconds, between firings of action events.
|
long |
getExpirationTime() |
int |
getInitialDelay()
Returns the
Timer 's initial delay. |
(package private) SWTTimer |
getNextTimer() |
boolean |
isCoalesce()
Returns
true if the Timer coalesces multiple
pending action events. |
boolean |
isRepeats()
Returns
true (the default) if the Timer will
send an action event to its listeners multiple times. |
boolean |
isRunning()
Returns
true if the Timer is running. |
(package private) void |
postOverride() |
void |
restart()
Restarts the
Timer , canceling any pending firings and
causing it to fire with its initial delay. |
void |
setCoalesce(boolean flag)
Sets whether the
Timer coalesces multiple pending
ActionEvent firings. |
void |
setDelay(int delay)
Sets the
Timer 's delay, the number of milliseconds between
successive action events. |
void |
setExpirationTime(long expirationTime) |
void |
setInitialDelay(int initialDelay)
Sets the
Timer 's initial delay, which by default is the same
as the between-event delay. |
(package private) void |
setNextTimer(SWTTimer nextTimer) |
void |
setRepeats(boolean flag)
If
flag is false , instructs the
Timer to send only one action event to its listeners. |
void |
setRunning(boolean running) |
void |
start()
Starts the
Timer , causing it to start sending action events
to its listeners. |
void |
stop()
Stops the
Timer , causing it to stop sending action events to
its listeners. |
(package private) SWTTimerQueue |
timerQueue()
Returns the timer queue.
|
addActionListener, getActionCommand, getActionListeners, getListeners, getLogTimers, removeActionListener, setActionCommand, setLogTimers
public SWTTimer(org.eclipse.swt.widgets.Display display, int delay, ActionListener listener)
display
- display associated with this timerdelay
- time in milliseconds between firings of this timerlistener
- action listener to fire when the timer firesprotected void fireActionPerformed(ActionEvent e)
fireActionPerformed
in class Timer
e
- the action event to fireSWTTimerQueue timerQueue()
public void setDelay(int delay)
Timer
's delay, the number of milliseconds between
successive action events.setDelay
in class Timer
delay
- the delay in millisecondssetInitialDelay(int)
public int getDelay()
getDelay
in class Timer
setDelay(int)
,
getInitialDelay()
public void setInitialDelay(int initialDelay)
Timer
's initial delay, which by default is the same
as the between-event delay. This is used only for the first action event.
Subsequent action events are spaced using the delay property.setInitialDelay
in class Timer
initialDelay
- the delay, in milliseconds, between the invocation of
the start
method and the first action event fired
by this timersetDelay(int)
public int getInitialDelay()
Timer
's initial delay. By default this is the
same as the value returned by getDelay.getInitialDelay
in class Timer
setInitialDelay(int)
,
setDelay(int)
public void setRepeats(boolean flag)
flag
is false
, instructs the
Timer
to send only one action event to its listeners.setRepeats
in class Timer
flag
- specify false
to make the timer stop after
sending its first action eventpublic boolean isRepeats()
true
(the default) if the Timer
will
send an action event to its listeners multiple times.isRepeats
in class Timer
setRepeats(boolean)
public void setCoalesce(boolean flag)
Timer
coalesces multiple pending
ActionEvent
firings. A busy application may not be able to
keep up with a Timer
's event generation, causing multiple
action events to be queued. When processed, the application sends these
events one after the other, causing the Timer
's listeners to
receive a sequence of events with no delay between them. Coalescing
avoids this situation by reducing multiple pending events to a single
event. Timer
s coalesce events by default.setCoalesce
in class Timer
flag
- specify false
to turn off coalescingpublic boolean isCoalesce()
true
if the Timer
coalesces multiple
pending action events.isCoalesce
in class Timer
setCoalesce(boolean)
public void start()
Timer
, causing it to start sending action events
to its listeners.public boolean isRunning()
true
if the Timer
is running.public void stop()
Timer
, causing it to stop sending action events to
its listeners.public void restart()
Timer
, canceling any pending firings and
causing it to fire with its initial delay.void cancelEventOverride()
stop
for that.void postOverride()
public void setExpirationTime(long expirationTime)
expirationTime
- the expirationTime to setpublic long getExpirationTime()
void setNextTimer(SWTTimer nextTimer)
nextTimer
- the nextTimer to setSWTTimer getNextTimer()
public void setRunning(boolean running)
running
- the running to setCopyright © 1995-2013 Piccolo2D. All Rights Reserved.