API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing. Timer View Source
Author(s)
Dave Moore
Since
Version
1.49 04/12/06
Serial
Hierarchy
 Object
      Timer
Implements
 Serializable
Subclasses
Description
public class Timer
  Fires one or more ActionEvents at specified intervals.
See also:    java.util.Timer
Constructors
public Timer (int delay, ActionListener listener)
  Creates a Timer and initializes both the initial delay and between-event delay to delay milliseconds.
Methods
Hide/Show inherited methods
public void addActionListener (ActionListener listener)
  Adds an action listener to the Timer.
pack-privatesynchronized void cancelEvent ()
  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.
public String getActionCommand ()
  Returns the string that will be delivered as the action command in ActionEvents fired by this timer.
public ActionListener getActionListeners ()
  Returns an array of all the action listeners registered on this timer.
public int getDelay ()
  Returns the delay, in milliseconds, between firings of action events.
public int getInitialDelay ()
  Returns the Timer's initial delay.
public T getListeners (Class< T> listenerType)
  Returns an array of all the objects currently registered as FooListeners upon this Timer.
publicstatic boolean getLogTimers ()
  Returns true if logging is enabled.
public boolean isCoalesce ()
  Returns true if the Timer coalesces multiple pending action events.
public boolean isRepeats ()
  Returns true (the default) if the Timer will send an action event to its listeners multiple times.
public boolean isRunning ()
  Returns true if the Timer is running.
pack-privatesynchronized void post ()
public void removeActionListener (ActionListener listener)
  Removes the specified action listener from the Timer.
public void restart ()
Restarts the Timer, canceling any pending firings and causing it to fire with its initial delay.
public void setActionCommand (String command)
  Sets the string that will be delivered as the action command in ActionEvents fired by this timer.
public void setCoalesce (boolean flag)
  Sets whether the Timer coalesces multiple pending ActionEvent firings.
public void setDelay (int delay)
  Sets the Timer's between-event delay, the number of milliseconds between successive action events.
public void setInitialDelay (int initialDelay)
  Sets the Timer's initial delay, the time in milliseconds to wait after the timer is started before firing the first event.
publicstatic void setLogTimers (boolean flag)
  Enables or disables the timer log.
public void setRepeats (boolean flag)
  If flag is false, instructs the Timer to send only one action event to its listeners.
public void start ()
  Starts the Timer, causing it to start sending action events to its listeners.
public void stop ()
  Stops the Timer, causing it to stop sending action events to its listeners.
pack-private TimerQueue timerQueue ()
Returns the timer queue.
Fields
Hide/Show inherited fields
pack-private boolean coalesce
pack-private int delay
pack-private Runnable doPostEvent
pack-private long expirationTime
pack-private int initialDelay
protected EventListenerList listenerList
pack-private Timer nextTimer
pack-private boolean repeats
pack-private boolean running
Nested Classes
  Timer.DoPostEvent
DoPostEvent is a runnable class that fires actionEvents to the listeners on the EventDispatchThread, via invokeLater.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar