John W. Campbell
This class provides an event based timer object. It may be added to the
list of JdlView objects under the control of the JdlViewManager object
and may be included, when required, in the list of 'active' objects from
which input is awaited. This object is recognised by the JdlViewManager object
as a special case and there is no window/display associated with it as there
is in the case of all the other JdlView objects.
Class, constructor and methods:
Class Details
Accessible Fields
Constructor
Operational Methods
Add/Remove Action Listener
- Package:
- Jdl.JdlView;
- Class name:
- JdlViewTimer
- Class definition:
- public class JdlViewTimer
- Extends:
- JdlDrawPanel
- Implements:
- ActionListener
JdlViewObject
- Actions:
- An action event will be generated when the timer 'fires'. The action command
string is "Timer".
The following accessible fields have been defined:
- static final long serialVersionUID
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlViewTimer object.
- Constructor Definition:
- public JdlViewTimer(int delay, boolean repeat)
- Parameters List:
- delay
- The required timer delay in milliseconds.
- repeat
- If true set as a repeat timer, else set as a once off timer.
This section contains the methods used to control the operation
of the timer.
Methods:
Set new delay - setNewDelay
Start the timer - start
Stop the timer - stop
Restart the timer - restart
This method sets a new value for the timer delay and a flag to indicate
whether or not it is to be a repeat timer. The timer is stopped by
this method and needs to be started explicitly when required by calling
the start(..) method.
- Method Definition:
- public void setNewDelay (int msecs, boolean repeat)
- Parameters List:
- msecs
- The required timer delay in milliseconds.
- repeat
- If true set as a repeat timer, else set as a once off timer.
This method starts the timer.
- Method Definition:
- public void start()
- Parameters List:
- none
This method stops the timer.
- Method Definition:
- public void stop()
- Parameters List:
- none
This method restarts the timer.
- Method Definition:
- public void restart()
- Parameters List:
- none
This section has methods to add or remove an action listener.
Methods:
Add action listener - addActionListener
Remove action listener - removeActionListener
This adds the specified action listener to receive action events from this
object.
- Method Definition:
- public void addActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be added.
This removes the specified action listener so that it no longer receives action
events from this object.
- Method Definition:
- public void removeActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be removed.
⇑ Up 3
⇑ Up 2
⇑ Up 1
⇑ Top of this