public class SourcedTimer
extends java.lang.Object
implements java.awt.event.ActionListener
Modifier and Type | Field and Description |
---|---|
protected static int |
_defaultGran
How often in milliseconds the baseTimer triggers
|
Constructor and Description |
---|
SourcedTimer(TimeSource src)
Create a SourcedTimer for the given source using
default granularity.
|
SourcedTimer(TimeSource src,
int granularity)
Create a SourcedTimer for the given source with the specified
granularity.
|
SourcedTimer(TimeSource src,
javax.swing.Timer timer)
Create a SourcedTimer for the given source.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Called in response to an ActionEvent from the associated
base timer.
|
void |
addSourcedTimerListener(SourcedTimerListener l)
Add a listener to this object.
|
long |
getConversionDivisor()
A client of SourcedTimer may need to convert source timer time
from raw units to some other units for display purposes.
|
void |
start()
Start the timer.
|
void |
stop()
Stop the timer.
|
protected static int _defaultGran
public SourcedTimer(TimeSource src)
src
- An object that implements the TimeSource interface.public SourcedTimer(TimeSource src, javax.swing.Timer timer)
src
- An object that implements the TimeSource interface.timer
- A java.swing.Timer object for use as base timer.public SourcedTimer(TimeSource src, int granularity)
src
- An object that implements the TimeSource interface.granularity
- Periood in milliseconds that base timer should fire.public void start()
public void stop()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- ActionEvent from base timer.public void addSourcedTimerListener(SourcedTimerListener l)
l
- An object that implements SourcedTimerListener interface.public long getConversionDivisor()