Package snap.view

Class ViewTimer

java.lang.Object
snap.view.ViewTimer

public class ViewTimer extends Object
A Timer to fire on node event thread.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViewTimer(Runnable onFire, int aPeriod)
    Constructor for runnable and period.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of times the timer has fired.
    int
    Returns the time in milliseconds between firings.
    Returns the run to be called.
    int
    Returns the elapsed time.
    boolean
    Returns whether timer is running.
    boolean
    Returns whether timer is running.
    void
    Pauses the timer (next play will start from previous time).
    protected void
    Sends the event.
    void
    setPeriod(int aPeriod)
    Sets the time in milliseconds between firings.
    void
    Start timer.
    void
    start(int aDelay)
    Start timer.
    void
    Stop timer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ViewTimer

      public ViewTimer(Runnable onFire, int aPeriod)
      Constructor for runnable and period.
  • Method Details

    • getRun

      public Runnable getRun()
      Returns the run to be called.
    • getPeriod

      public int getPeriod()
      Returns the time in milliseconds between firings.
    • setPeriod

      public void setPeriod(int aPeriod)
      Sets the time in milliseconds between firings.
    • isRunning

      public boolean isRunning()
      Returns whether timer is running.
    • isPaused

      public boolean isPaused()
      Returns whether timer is running.
    • getTime

      public int getTime()
      Returns the elapsed time.
    • getCount

      public int getCount()
      Returns the number of times the timer has fired.
    • start

      public void start()
      Start timer.
    • start

      public void start(int aDelay)
      Start timer.
    • stop

      public void stop()
      Stop timer.
    • pause

      public void pause()
      Pauses the timer (next play will start from previous time).
    • sendEvent

      protected void sendEvent()
      Sends the event.