|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.lib.timer.TimerModel
public class TimerModel
TimerModel class - Wraps around Timer class, - Counts to a given amount of time - And IF the applet is timed, Issues an ActionEvent to help main applet terminate itself - This is a notifier class - it notifies all its listeners through their actionPerformed. It is not capable of calling methods specific to those listeners, including paint(). - How to use: Create an instance, call startTimer() Call pauseTimer() and resumeTimer() if necessary Call stopTimer() at the end Call restartTimer() to time a new session
Field Summary | |
---|---|
static java.lang.String |
PULSE
|
Constructor Summary | |
---|---|
TimerModel(java.awt.event.ActionListener inClient,
int inStopTime)
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Handles updating the elapsed seconds If the elapsed time has exceeded preset end time, issues an ActionEvent for the main application. |
void |
addActionListener(java.awt.event.ActionListener listener)
Method to add actionListener to the TimerModel |
int |
getElapsedTime()
|
void |
pauseTimer()
Pauses the timer without resetting the count. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Method to remove actionListener to the TimerModel |
void |
restartTimer()
Restarts the timer, and initializes count. |
void |
resumeTimer()
Resumes the timer, resumes the count |
void |
startTimer()
Starts the timer, and initializes count. |
int |
stopTimer()
Stops the timer, returns the count and resets it |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PULSE
Constructor Detail |
---|
public TimerModel(java.awt.event.ActionListener inClient, int inStopTime)
Any
- class that implements ActionListener interfaceThe
- duration in minutes that the timer should tickMethod Detail |
---|
public int getElapsedTime()
public void startTimer()
public void pauseTimer()
public void resumeTimer()
public int stopTimer()
public void restartTimer()
public void addActionListener(java.awt.event.ActionListener listener)
public void removeActionListener(java.awt.event.ActionListener listener)
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- The ActionEvent object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |