TransitionEvent (JavaFX 28)
Description: declaration: module: javafx.graphics, package: javafx.css, class: TransitionEvent

# Class TransitionEvent

java.lang.Object
java.util.EventObject
javafx.event.Event
javafx.css.TransitionEvent

All Implemented Interfaces:
  `Serializable, Cloneable`

public final class TransitionEvent extends Event
An event that signals the creation, beginning, completion and cancellation of implicit CSS transitions.

Note that this event is not raised for explicit transitions that are created using the `Transition` class.

Since:
  23
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final EventType<TransitionEvent>`
  `ANY`
  Common supertype for all `TransitionEvent` types.
  `static final EventType<TransitionEvent>`
  `CANCEL`
  This event occurs when a running transition was cancelled before it has reached the end of its active period.
  `static final EventType<TransitionEvent>`
  `END`
  This event occurs when a running transition has reached the end of its active period.
  `static final EventType<TransitionEvent>`
  `RUN`
  This event occurs when a transition has been created and added to the list of running transitions of a `Node`.
  `static final EventType<TransitionEvent>`
  `START`
  This event occurs when a running transition enters its active period, which happens at the end of the delay phase.

  ### Fields declared in class Event

  `consumed, eventType, NULL_SOURCE_TARGET, target`

  ### Fields declared in class EventObject

  `source`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TransitionEvent(EventType<? extends Event> eventType, StyleableProperty<?> property, String propertyName, Duration elapsedTime)`
  Creates a new instance of the `TransitionEvent` class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Duration`
  `getElapsedTime()`
  Gets the time that has elapsed since the transition has entered its active period, not including the time spent in the delay phase.
  `StyleableProperty<?>`
  `getProperty()`
  Gets the `StyleableProperty` that is targeted by the transition.
  `String`
  `getPropertyName()`
  Gets the name of the CSS property or sub-property that is targeted by the transition.

  ### Methods declared in class Event

  `clone, consume, copyFor, fireEvent, getEventType, getTarget, isConsumed`

  ### Methods declared in class EventObject

  `getSource, toString`

  ### Methods declared in class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### ANY

    public static final EventType<TransitionEvent> ANY
    Common supertype for all `TransitionEvent` types.

  - ### RUN

    public static final EventType<TransitionEvent> RUN
    This event occurs when a transition has been created and added to the list of running transitions of a `Node`.

  - ### START

    public static final EventType<TransitionEvent> START
    This event occurs when a running transition enters its active period, which happens at the end of the delay phase.

  - ### END

    public static final EventType<TransitionEvent> END
    This event occurs when a running transition has reached the end of its active period. If the transition is cancelled prior to reaching the end of its active period, this event does not occur.

  - ### CANCEL

    public static final EventType<TransitionEvent> CANCEL
    This event occurs when a running transition was cancelled before it has reached the end of its active period.

- ## Constructor Details

  - ### TransitionEvent

    public TransitionEvent(EventType<? extends Event> eventType, StyleableProperty<?> property, String propertyName, Duration elapsedTime)
    Creates a new instance of the `TransitionEvent` class.
    Parameters:
      `eventType` - the event type
      `property` - the `StyleableProperty` that is targeted by the transition
      `propertyName` - the name of the targeted CSS property or sub-property
      `elapsedTime` - the time that has elapsed since the transition has entered its active period
    Throws:
      `NullPointerException` - if any of the arguments is `null`
    Since:
      24

- ## Method Details

  - ### getProperty

    public StyleableProperty<?> getProperty()
    Gets the `StyleableProperty` that is targeted by the transition.
    Returns:
      the `StyleableProperty`

  - ### getPropertyName

    public String getPropertyName()
    Gets the name of the CSS property or sub-property that is targeted by the transition.

    The name of the CSS property under transition can be a long-hand property name, which is different from the name returned by `CssMetaData.getProperty()` of the `StyleableProperty` that is targeted by the transition. For example, if a transition targets `Region.borderProperty()`, the name of the CSS property might be `-fx-border-color`, `-fx-border-radius`, etc.

    Returns:
      the CSS property or sub-property name
    Since:
      24

  - ### getElapsedTime

    public Duration getElapsedTime()
    Gets the time that has elapsed since the transition has entered its active period, not including the time spent in the delay phase.
    Returns:
      the elapsed time, or zero if the transition has not entered its active period