Class Timer

java.lang.Object
jfxtras.animation.Timer

public class Timer extends Object
A timer class in the spirit of java.swing.Timer but using JavaFX properties.
Author:
Tom Eugelink
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
    cycleDuration: time between fires
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
    delay: initial delay
    javafx.beans.property.ObjectProperty<Boolean>
    repeats: If flag is false, instructs the Timer to send only one action event to its listeners.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Timer(boolean isDaemon, Runnable runnable)
     
    Timer(Runnable runnable)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
    cycleDuration: time between fires
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
    delay: initial delay
    javafx.util.Duration
    Gets the value of the cycleDuration property.
    javafx.util.Duration
    Gets the value of the delay property.
    boolean
    Gets the value of the repeats property.
    javafx.beans.property.ObjectProperty<Boolean>
    repeats: If flag is false, instructs the Timer to send only one action event to its listeners.
    restart the timer
    void
    setCycleDuration(javafx.util.Duration value)
    Sets the value of the cycleDuration property.
    void
    setDelay(javafx.util.Duration value)
    Sets the value of the delay property.
    void
    setRepeats(boolean value)
    Sets the value of the repeats property.
    Start the timer
    stop the timer if running
    withCycleDuration(javafx.util.Duration value)
     
    withDelay(javafx.util.Duration value)
     
    withRepeats(boolean value)
     

    Methods inherited from class Object

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

  • Constructor Details

    • Timer

      public Timer(Runnable runnable)
      Parameters:
      runnable -
    • Timer

      public Timer(boolean isDaemon, Runnable runnable)
      Parameters:
      isDaemon -
      runnable -
  • Method Details

    • delayProperty

      public javafx.beans.property.ObjectProperty<javafx.util.Duration> delayProperty()
      delay: initial delay
      Returns:
      the delay property
      See Also:
    • getDelay

      public javafx.util.Duration getDelay()
      Gets the value of the delay property.
      Property description:
      delay: initial delay
      Returns:
      the value of the delay property
      See Also:
    • setDelay

      public void setDelay(javafx.util.Duration value)
      Sets the value of the delay property.
      Property description:
      delay: initial delay
      Parameters:
      value - the value for the delay property
      See Also:
    • withDelay

      public Timer withDelay(javafx.util.Duration value)
    • cycleDurationProperty

      public javafx.beans.property.ObjectProperty<javafx.util.Duration> cycleDurationProperty()
      cycleDuration: time between fires
      Returns:
      the cycleDuration property
      See Also:
    • getCycleDuration

      public javafx.util.Duration getCycleDuration()
      Gets the value of the cycleDuration property.
      Property description:
      cycleDuration: time between fires
      Returns:
      the value of the cycleDuration property
      See Also:
    • setCycleDuration

      public void setCycleDuration(javafx.util.Duration value)
      Sets the value of the cycleDuration property.
      Property description:
      cycleDuration: time between fires
      Parameters:
      value - the value for the cycleDuration property
      See Also:
    • withCycleDuration

      public Timer withCycleDuration(javafx.util.Duration value)
    • repeatsProperty

      public javafx.beans.property.ObjectProperty<Boolean> repeatsProperty()
      repeats: If flag is false, instructs the Timer to send only one action event to its listeners.
      Returns:
      the repeats property
      See Also:
    • getRepeats

      public boolean getRepeats()
      Gets the value of the repeats property.
      Property description:
      repeats: If flag is false, instructs the Timer to send only one action event to its listeners.
      Returns:
      the value of the repeats property
      See Also:
    • setRepeats

      public void setRepeats(boolean value)
      Sets the value of the repeats property.
      Property description:
      repeats: If flag is false, instructs the Timer to send only one action event to its listeners.
      Parameters:
      value - the value for the repeats property
      See Also:
    • withRepeats

      public Timer withRepeats(boolean value)
    • start

      public Timer start()
      Start the timer
    • stop

      public Timer stop()
      stop the timer if running
    • restart

      public Timer restart()
      restart the timer