Package lejos.utility

Class Timer


  • public class Timer
    extends java.lang.Object
    Timer object, with some similar functionality to java.Swing.Timer.
    Author:
    Ryan VanderBijl
    • Constructor Summary

      Constructors 
      Constructor Description
      Timer​(int theDelay, TimerListener el)
      Create a Timer object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDelay()
      access how man milliseconds between timedOut() messages.
      void setDelay​(int newDelay)
      Change the delay between timedOut messages.
      void start()
      Starts the timer, telling it to send timeOut() methods to the TimerListener.
      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​(int theDelay,
                     TimerListener el)
        Create a Timer object. Every theDelay milliseconds the el.timedOut() function is called. You may change the delay with setDelay(int). You need to call start() explicitly.
    • Method Detail

      • getDelay

        public int getDelay()
        access how man milliseconds between timedOut() messages.
      • setDelay

        public void setDelay​(int newDelay)
        Change the delay between timedOut messages. Safe to call while start()ed. Time in milli-seconds.
      • stop

        public void stop()
        Stops the timer. timedOut() messages are not sent.
      • start

        public void start()
        Starts the timer, telling it to send timeOut() methods to the TimerListener.