edu.umd.cs.piccolox.swt
Class SWTTimer

java.lang.Object
  extended by javax.swing.Timer
      extended by edu.umd.cs.piccolox.swt.SWTTimer
All Implemented Interfaces:
java.io.Serializable

public class SWTTimer
extends javax.swing.Timer

Author:
Lance Good
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.Timer
listenerList
 
Constructor Summary
SWTTimer(org.eclipse.swt.widgets.Display display, int delay, java.awt.event.ActionListener listener)
          Constructor for SWTTimer.
 
Method Summary
protected  void fireActionPerformed(java.awt.event.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.
 int getInitialDelay()
          Returns the Timer's initial delay.
 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.
 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 setInitialDelay(int initialDelay)
          Sets the Timer's initial delay, which by default is the same as the between-event delay.
 void setRepeats(boolean flag)
          If flag is false, instructs the Timer to send only one action event to its listeners.
 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.
 
Methods inherited from class javax.swing.Timer
addActionListener, getActionListeners, getListeners, getLogTimers, removeActionListener, setLogTimers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTTimer

public SWTTimer(org.eclipse.swt.widgets.Display display,
                int delay,
                java.awt.event.ActionListener listener)
Constructor for SWTTimer.

Parameters:
delay -
listener -
Method Detail

fireActionPerformed

protected void fireActionPerformed(java.awt.event.ActionEvent e)
Notifies all listeners that have registered interest for notification on this event type.

Overrides:
fireActionPerformed in class javax.swing.Timer
Parameters:
e - the action event to fire

setDelay

public void setDelay(int delay)
Sets the Timer's delay, the number of milliseconds between successive action events.

Overrides:
setDelay in class javax.swing.Timer
Parameters:
delay - the delay in milliseconds
See Also:
setInitialDelay(int)

getDelay

public int getDelay()
Returns the delay, in milliseconds, between firings of action events.

Overrides:
getDelay in class javax.swing.Timer
See Also:
setDelay(int), getInitialDelay()

setInitialDelay

public void setInitialDelay(int initialDelay)
Sets the 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.

Overrides:
setInitialDelay in class javax.swing.Timer
Parameters:
initialDelay - the delay, in milliseconds, between the invocation of the start method and the first action event fired by this timer
See Also:
setDelay(int)

getInitialDelay

public int getInitialDelay()
Returns the Timer's initial delay.

Overrides:
getInitialDelay in class javax.swing.Timer
See Also:
setInitialDelay(int), setDelay(int)

setRepeats

public void setRepeats(boolean flag)
If flag is false, instructs the Timer to send only one action event to its listeners.

Overrides:
setRepeats in class javax.swing.Timer
Parameters:
flag - specify false to make the timer stop after sending its first action event

isRepeats

public boolean isRepeats()
Returns true (the default) if the Timer will send an action event to its listeners multiple times.

Overrides:
isRepeats in class javax.swing.Timer
See Also:
setRepeats(boolean)

setCoalesce

public void setCoalesce(boolean flag)
Sets whether the 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. Timers coalesce events by default.

Overrides:
setCoalesce in class javax.swing.Timer
Parameters:
flag - specify false to turn off coalescing

isCoalesce

public boolean isCoalesce()
Returns true if the Timer coalesces multiple pending action events.

Overrides:
isCoalesce in class javax.swing.Timer
See Also:
setCoalesce(boolean)

start

public void start()
Starts the Timer, causing it to start sending action events to its listeners.

Overrides:
start in class javax.swing.Timer
See Also:
stop()

isRunning

public boolean isRunning()
Returns true if the Timer is running.

Overrides:
isRunning in class javax.swing.Timer
See Also:
start()

stop

public void stop()
Stops the Timer, causing it to stop sending action events to its listeners.

Overrides:
stop in class javax.swing.Timer
See Also:
start()

restart

public void restart()
Restarts the Timer, canceling any pending firings and causing it to fire with its initial delay.

Overrides:
restart in class javax.swing.Timer


Copyright 2005 by University of Maryland, College Park, MD 20742, USA All rights reserved.

Web Accessibility