|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.fmj.ejmf.toolkit.util.SourcedTimer
public class SourcedTimer
The SourcedTimer class implements a timer dependent on a named source. This is a generalization of a timer simply dependent on a monotonically increasing clock. An instance of SourcedTimer creates a java.swing.Timer and becomes a listener on that timer. This timer is called the base timer. Every time the base timer fires, the SourcedTimer object asks its source what time it is and then notifies its listeners. This class is used by the TimerPlayer to track media time. From the book: Essential JMF, Gordon, Talley (ISBN 0130801046). Used with permission. see java.awt.swing.Timer see ejmf.toolkit.TimeSource see ejmf.examples.timerplayer.TimerPlayer
Field Summary | |
---|---|
protected static int |
_defaultGran
How often in milliseconds the baseTimer triggers |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int _defaultGran
Constructor Detail |
---|
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.Method Detail |
---|
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |