All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gjt.Stopwatch

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----gjt.Stopwatch

public class Stopwatch
extends Thread
A Thread that acts as a stopwatch.

Stopwatch starts running when it is constructed, and may be reset by the reset() method. getHour(), getMinute(), getSecond(), and getMillisecond() are used to get the elapsed time since construction, or since the last reset.

toString() returns the elapsed time in the form of HH:MM:SS:mm, where HH == hours, MM == minutes, SS == seconds and mm == milliseconds.

Each Stopwatch may have a StopwatchClient associated with it. If the StopwatchClient is non-null, the StopwatchClients' tick() method is invoked every 50 milliseconds.

Version 1.1 Changes: Added tickInterval and void setTickInterval() Added constructor that takes tickInterval as 2nd argument. Pass Stopwatch reference when StopwatchClient's tick() method called.

See Also:
StopwatchClient, Sequence, Sprite

Constructor Index

 o Stopwatch()
 o Stopwatch(StopwatchClient)
 o Stopwatch(StopwatchClient, long)

Method Index

 o elapsedTime()
 o getHour()
 o getMillisecond()
 o getMinute()
 o getSecond()
 o reset()
 o run()
 o setTickInterval(long)
 o toString()
 o update()

Constructors

 o Stopwatch
 public Stopwatch()
 o Stopwatch
 public Stopwatch(StopwatchClient client)
 o Stopwatch
 public Stopwatch(StopwatchClient client,
                  long milliseconds)

Methods

 o setTickInterval
 public void setTickInterval(long milliseconds)
 o update
 public void update()
 o toString
 public String toString()
Overrides:
toString in class Thread
 o getHour
 public long getHour()
 o getMinute
 public long getMinute()
 o getSecond
 public long getSecond()
 o getMillisecond
 public long getMillisecond()
 o elapsedTime
 public long elapsedTime()
 o reset
 public void reset()
 o run
 public void run()
Overrides:
run in class Thread

All Packages  Class Hierarchy  This Package  Previous  Next  Index