erland.util
Class Timer

java.lang.Object
  extended by erland.util.Timer
All Implemented Interfaces:
Runnable

public class Timer
extends Object
implements Runnable

Timer class that calls your object at regular intervals

Author:
Erland Isaksson

Constructor Summary
Timer(long delay, TimerListenerInterface listener)
          Creates a new timer object which calls the specified listener at the specified interval
 
Method Summary
 long getDelay()
          Gets the current delay between timer tics
 boolean isRunning()
          Checks if the timer is running
 void run()
          Main loop
 void setDelay(long delay)
          Sets the delay between timer ticks
 void start()
          Starts the timer after it has been stopped
 void stop()
          Stops the timer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer(long delay,
             TimerListenerInterface listener)
Creates a new timer object which calls the specified listener at the specified interval

Parameters:
delay - Number of milliseconds between calls
listener - Listener object that should be called
Method Detail

isRunning

public boolean isRunning()
Checks if the timer is running


stop

public void stop()
Stops the timer


start

public void start()
Starts the timer after it has been stopped


setDelay

public void setDelay(long delay)
Sets the delay between timer ticks

Parameters:
delay - Number of milliseconds between each timer tick

getDelay

public long getDelay()
Gets the current delay between timer tics

Returns:
Number of milliseconds between each timer tick

run

public void run()
Main loop

Specified by:
run in interface Runnable


Copyright © 2003-2005 Erland Isaksson. All Rights Reserved.