vipratech.beans.standardbeans
Class Clock

java.lang.Object
  |
  +--vipratech.beans.standardbeans.Clock

public class Clock
extends java.lang.Object
implements java.lang.Runnable

The Clock.class provides the timer to that is visible at design time but invisible at run time. It can be wired up using action listeners at design time.

The clock sends a "tick" (an action event) every simualtion second to registered listeners. The interval between ticks is set using the setMillisecsPerSec(int millisecsPerSec) method. The default value is 1000ms, but other values of ms can be chosen to represent 1 simulation second.

Version:
1.00, December 27, 1999
Author:
Warwick Bailey   warwick-bailey@bigfoot.com
See Also:
HorizontalChartRecorder

Constructor Summary
Clock()
          Constructor
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Allows this component to be wired at design time with action listeners.
 java.lang.String calculateTime(int time)
          Converts an int value to an hh:mm:ss time representation.
 void destroy()
          Kills thread when shutting down.
 int getMillisecsPerSec()
          Returns the interval to represent 1 simulation second.
 int getTime()
          Returns the current time in simualtion seconds.
 java.lang.String getTimeAsString()
          Returns the current time as a string.
 void removeActionListener(java.awt.event.ActionListener listener)
          Allows this component to be un-wired at design time with action listeners.
 void run()
          Sends a "tick" to registered listeners.
 void setMillisecsPerSec(int millisecsPerSec)
          Sets the interval to represent 1 simulation second.
 void start()
          Starts the clock.
 void stop()
          Stops the clock.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Clock

public Clock()
Constructor
Method Detail

start

public final void start()
Starts the clock.

stop

public final void stop()
Stops the clock.

run

public final void run()
Sends a "tick" to registered listeners.
Specified by:
run in interface java.lang.Runnable

calculateTime

public java.lang.String calculateTime(int time)
Converts an int value to an hh:mm:ss time representation.

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Allows this component to be wired at design time with action listeners.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Allows this component to be un-wired at design time with action listeners.

destroy

public final void destroy()
Kills thread when shutting down.

setMillisecsPerSec

public final void setMillisecsPerSec(int millisecsPerSec)
Sets the interval to represent 1 simulation second. Default is 1000ms.

getMillisecsPerSec

public final int getMillisecsPerSec()
Returns the interval to represent 1 simulation second. Default is 1000ms.

getTime

public final int getTime()
Returns the current time in simualtion seconds.

getTimeAsString

public final java.lang.String getTimeAsString()
Returns the current time as a string. The representation is hh/mm/ss.

dathe@chemie.uni-leipzig.de"

http://leipzig.vernetztes-studium.de