Class ViewPlots.Timer

java.lang.Object
  extended byViewPlots.Timer
Enclosing class:
ViewPlots

class ViewPlots.Timer
extends java.lang.Object

Timer supporting class for ViewPlots This class is a substitue class for the javax.swing.Timer class. This was to accomidate the re-write from swing code to 1.1 for browser support.

Author:
Daniel J. Adams

Field Summary
private  ViewPlots.TimerThread itsThread
          Independant thread used for timing purposes
 
Constructor Summary
ViewPlots.Timer(long theInterval, java.awt.event.ActionListener theListener)
          Basic constructor for Timer Allows the initial delay between 'ticks' to be set, as well as setting which object will be the consumer of these ticks.
 
Method Summary
 long getDelay()
          Fetches the current timer delay period
 boolean isRunning()
          Check for timer thread running Returns true if there is a timer thread currently executing, otherwise returns false.
 void setDelay(long theInterval)
          Sets the timer delay period to a new setting.
 void start()
          Starts a timer thread executing.
 void stop()
          Halts any executing timer thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itsThread

private ViewPlots.TimerThread itsThread
Independant thread used for timing purposes

Constructor Detail

ViewPlots.Timer

public ViewPlots.Timer(long theInterval,
                       java.awt.event.ActionListener theListener)
Basic constructor for Timer Allows the initial delay between 'ticks' to be set, as well as setting which object will be the consumer of these ticks.

Parameters:
theInterval - Delay between ticks in microseconds
theListener - ActionListener that consumes timer ticks.
Method Detail

getDelay

public long getDelay()
Fetches the current timer delay period

Returns:
long The current delay between ticks in microseconds.

setDelay

public void setDelay(long theInterval)
Sets the timer delay period to a new setting.

Parameters:
theInterval - Delay between timer ticks in microseconds

isRunning

public boolean isRunning()
Check for timer thread running Returns true if there is a timer thread currently executing, otherwise returns false.

Returns:
boolean State of timer thread

stop

public void stop()
Halts any executing timer thread. Safe method that will cause the timer thread to expire on its next wakeup.


start

public void start()
Starts a timer thread executing. Safe method that will start a new timer thread, unless there is a currently executing timer thread.