edu.luc.cs.trull.demo.task
Class TimerDemo
java.lang.Object
edu.luc.cs.trull.EmptyComponent
edu.luc.cs.trull.TerminatingComponent
edu.luc.cs.trull.AbstractComponent
edu.luc.cs.trull.EmitComponent
edu.luc.cs.trull.demo.task.TimerDemo
- All Implemented Interfaces:
- Component, EventLabels, PropertyChangeSource, Startable, Suspendable, Terminating, java.beans.PropertyChangeListener, java.util.EventListener
public class TimerDemo
- extends EmitComponent
- implements EventLabels
This example demonstrates how a Swing timer can be placed
under the control of a suitable Trull component.
|
Field Summary |
static java.lang.String |
DEFAULT_LABEL
|
private java.lang.String |
label
|
private java.awt.event.ActionListener |
listener
|
private int |
max
|
private int |
min
|
private javax.swing.Timer |
timer
|
|
Constructor Summary |
TimerDemo(int min,
int max)
|
TimerDemo(int min,
int max,
java.lang.String label)
|
|
Method Summary |
static void |
main(java.lang.String[] args)
|
void |
resume()
Resumes this suspendable component. |
void |
setRandomDelay()
|
void |
start(java.beans.PropertyChangeEvent incoming)
Starts this startable component. |
void |
stop()
Stops this startable component. |
void |
suspend()
Suspends this suspendable component. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_LABEL
public static final java.lang.String DEFAULT_LABEL
- See Also:
- Constant Field Values
label
private final java.lang.String label
listener
private final java.awt.event.ActionListener listener
max
private int max
min
private int min
timer
private final javax.swing.Timer timer
TimerDemo
public TimerDemo(int min,
int max)
TimerDemo
public TimerDemo(int min,
int max,
java.lang.String label)
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception
resume
public void resume()
- Description copied from interface:
Suspendable
- Resumes this suspendable component.
- Specified by:
resume in interface Suspendable- Overrides:
resume in class EmitComponent
setRandomDelay
public void setRandomDelay()
start
public void start(java.beans.PropertyChangeEvent incoming)
- Description copied from interface:
Startable
- Starts this startable component.
- Specified by:
start in interface Startable- Overrides:
start in class EmitComponent
- Parameters:
incoming - the event that triggered the invocation of this method. May be null.
stop
public void stop()
- Description copied from interface:
Startable
- Stops this startable component.
- Specified by:
stop in interface Startable- Overrides:
stop in class EmitComponent
suspend
public void suspend()
- Description copied from interface:
Suspendable
- Suspends this suspendable component.
- Specified by:
suspend in interface Suspendable- Overrides:
suspend in class EmitComponent
http://www.cs.luc.edu/trull/