public class TimeDisplayControl extends java.lang.Object implements Control, SourcedTimerListener, TimeSource, ControllerListener
Creates a SourcedTimer to generate ticks that trigger Control to look at media time, convert it to a string and display it.
Registers as SourcedTimerListener and ControllerListener. As ControllerListener, TimerDisplayControl listens for start/restart and stop events to correctly turn SourcedTimer on and off.
SourcedTimer,
SourcedTimerListener,
TimeSourceMICROS_PER_SEC, MILLIS_PER_SEC, NANOS_PER_SEC| Constructor and Description |
|---|
TimeDisplayControl(Controller controller)
Create a TimeDisplayControl for displaying the
current media time of the Controller passed as an
argument.
|
TimeDisplayControl(Controller controller,
SourcedTimer timer)
Create a TimeDisplayControl for displaying the
current media time of the Controller passed as an
argument.
|
| Modifier and Type | Method and Description |
|---|---|
void |
controllerUpdate(ControllerEvent e)
Listen for start/stop events and start/stop
SourceTimer in response.
|
java.awt.Component |
getControlComponent()
Return the control component.
|
long |
getConversionDivisor()
Report value such that
getTime()/number equals seconds. |
long |
getTime()
Report media time from associated Controller.
|
void |
timerUpdate(SourcedTimerEvent e)
Respond to 'tick' from SourcedTimer.
|
public TimeDisplayControl(Controller controller)
controller - The Controller with which to associate
control.public TimeDisplayControl(Controller controller, SourcedTimer timer)
The timer is used as the SourcedTimer.
This form of the constructor allows reuse of an existing
SourcedTimer.
controller - javax.media.Controllertimer - ejmf.toolkit.util.SourcedTimerSourcedTimerpublic java.awt.Component getControlComponent()
getControlComponent in interface Controlpublic void timerUpdate(SourcedTimerEvent e)
timerUpdate in interface SourcedTimerListenere - a SourcedTimerEvent containing TimeSource
that generated tick.public void controllerUpdate(ControllerEvent e)
controllerUpdate in interface ControllerListenere - A controller event used to determine start/stop
state of timer.public long getTime()
getTime in interface TimeSourcepublic long getConversionDivisor()
getTime()/number equals seconds.
getConversionDivisor in interface TimeSourcegetTime()/number equals
seconds.