Class AnimationEvent


  • public final class AnimationEvent
    extends java.lang.Object
    An immutable object that describes events appropriate for animations with the source animation, the type (started, stopped), and the time the event has happened.
    Version:
    $Revision: 1.8 $
    See Also:
    AnimationListener
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AnimationEvent.Type
      Enumerates the animation event types: started and stopped.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Animation source
      The animation that has been started or stopped.
      private long time
      Describes when the event has been created.
      private AnimationEvent.Type type
      Describes the state change of the animation: started or stopped.
    • Constructor Summary

      Constructors 
      Constructor Description
      AnimationEvent​(Animation source, AnimationEvent.Type type, long time)
      Constructs an AnimationEvent for the initiating animation, event type, and time.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Animation getSource()
      Returns the animation the has originated this event.
      long time()
      Returns the time when this event has happened in the time interval of this event's source animation.
      java.lang.String toString()
      Returns an appropriate string representation.
      AnimationEvent.Type type()
      Returns the event type: started or stopped.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • source

        private final Animation source
        The animation that has been started or stopped.
      • type

        private final AnimationEvent.Type type
        Describes the state change of the animation: started or stopped.
      • time

        private final long time
        Describes when the event has been created.
    • Constructor Detail

      • AnimationEvent

        AnimationEvent​(Animation source,
                       AnimationEvent.Type type,
                       long time)
        Constructs an AnimationEvent for the initiating animation, event type, and time.
        Parameters:
        source - the Animation that has originated the event
        type - the event type: start or stop
        time - the time the event has happened, which is likely before the event has been created
    • Method Detail

      • getSource

        public Animation getSource()
        Returns the animation the has originated this event.
        Returns:
        the animation that has originated this event
      • type

        public AnimationEvent.Type type()
        Returns the event type: started or stopped.
        Returns:
        the event type: started or stopped
      • time

        public long time()
        Returns the time when this event has happened in the time interval of this event's source animation. This time may differ from the time the event has been created.
        Returns:
        the time the event has happened
      • toString

        public java.lang.String toString()
        Returns an appropriate string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation for this event