public class Timer
extends java.lang.Object
implements java.lang.Runnable
Constructor and Description |
---|
Timer(double seconds,
boolean loop,
java.lang.Runnable r)
Creates a Timer that calls method "c" after X amount of seconds have gone by (possibly multiple times if looping)
|
Timer(double seconds,
java.lang.Runnable r)
Creates a Timer that calls method "c" after X amount of seconds have gone by.
|
Modifier and Type | Method and Description |
---|---|
void |
run()
The loop that makes this timer work.
|
Timer |
start()
Starts the Timer.
|
void |
stop()
Stops this timer.
|
public Timer(double seconds, java.lang.Runnable r)
seconds
- How many seconds the timer will wait before calling "c".r
- A Runnable that represents the function to be called.public Timer(double seconds, boolean loop, java.lang.Runnable r)
seconds
- How many seconds the timer will wait before calling "c".loop
- If the timer should keep looping.r
- A Runnable that represents the function to be called.public Timer start()
public void run()
run
in interface java.lang.Runnable
public void stop()