3.2.8 - View Timer - JdlViewTimer

John W. Campbell

3.2.8.1 Introduction

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

3.2.8.2 Class Details

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".

3.2.8.3 Accessible Fields

The following accessible fields have been defined:

static final long serialVersionUID

3.2.8.4 Constructor

3.2.8.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

3.2.8.4.2 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.

3.2.8.5 Operational Methods

3.2.8.5.1 Introduction

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

3.2.8.5.2 Set new delay - setNewDelay

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.

3.2.8.5.3 Start the timer - start

This method starts the timer.

Method Definition:
public void start()
Parameters List:
none

3.2.8.5.4 Stop the timer - stop

This method stops the timer.

Method Definition:
public void stop()
Parameters List:
none

3.2.8.5.5 Restart the timer - restart

This method restarts the timer.

Method Definition:
public void restart()
Parameters List:
none

3.2.8.6 Add/Remove Action Listener

3.2.8.6.1 Introduction

This section has methods to add or remove an action listener.

Methods:

Add action listener - addActionListener
Remove action listener - removeActionListener

3.2.8.6.2 Add action listener - addActionListener

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.

3.2.8.6.3 Remove action listener - removeActionListener

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