Module javafx.base
Package javafx.event

# Interface EventTarget

All Known Implementing Classes:
  `Accordion`, `Affine`, `Alert`, `AmbientLight`, `AnchorPane`, `Arc`, `AreaChart`, `Axis`, `BarChart`, `BorderPane`, `Box`, `BubbleChart`, `Button`, `ButtonBar`, `ButtonBase`, `Camera`, `Canvas`, `CategoryAxis`, `Cell`, `Chart`, `CheckBox`, `CheckBoxListCell`, `CheckBoxTableCell`, `CheckBoxTreeCell`, `CheckBoxTreeItem`, `CheckBoxTreeTableCell`, `CheckMenuItem`, `ChoiceBox`, `ChoiceBoxListCell`, `ChoiceBoxTableCell`, `ChoiceBoxTreeCell`, `ChoiceBoxTreeTableCell`, `ChoiceDialog`, `Circle`, `ColorPicker`, `ComboBox`, `ComboBoxBase`, `ComboBoxListCell`, `ComboBoxTableCell`, `ComboBoxTreeCell`, `ComboBoxTreeTableCell`, `ContextMenu`, `Control`, `CubicCurve`, `CustomMenuItem`, `Cylinder`, `DateCell`, `DatePicker`, `Dialog`, `DialogPane`, `DirectionalLight`, `Ellipse`, `FlowPane`, `GridPane`, `Group`, `HBox`, `HTMLEditor`, `Hyperlink`, `ImageView`, `IndexedCell`, `Label`, `Labeled`, `LightBase`, `Line`, `LineChart`, `ListCell`, `ListView`, `MediaView`, `Menu`, `MenuBar`, `MenuButton`, `MenuItem`, `MeshView`, `NestedTableColumnHeader`, `Node`, `NumberAxis`, `Pagination`, `Pane`, `ParallelCamera`, `Parent`, `PasswordField`, `Path`, `PerspectiveCamera`, `PieChart`, `PointLight`, `Polygon`, `Polyline`, `Popup`, `PopupControl`, `PopupControl.CSSBridge`, `PopupWindow`, `ProgressBar`, `ProgressBarTableCell`, `ProgressBarTreeTableCell`, `ProgressIndicator`, `QuadCurve`, `RadioButton`, `RadioMenuItem`, `Rectangle`, `Region`, `Rotate`, `Scale`, `ScatterChart`, `Scene`, `ScheduledService`, `ScrollBar`, `ScrollPane`, `Separator`, `SeparatorMenuItem`, `Service`, `Shape`, `Shape3D`, `Shear`, `Slider`, `Sphere`, `Spinner`, `SplitMenuButton`, `SplitPane`, `SpotLight`, `StackedAreaChart`, `StackedBarChart`, `StackPane`, `Stage`, `SubScene`, `SVGPath`, `SwingNode`, `Tab`, `TableCell`, `TableColumn`, `TableColumnBase`, `TableColumnHeader`, `TableHeaderRow`, `TableRow`, `TableView`, `TabPane`, `Task`, `Text`, `TextArea`, `TextField`, `TextFieldListCell`, `TextFieldTableCell`, `TextFieldTreeCell`, `TextFieldTreeTableCell`, `TextFlow`, `TextInputControl`, `TextInputDialog`, `TilePane`, `TitledPane`, `ToggleButton`, `ToolBar`, `Tooltip`, `Transform`, `Translate`, `TreeCell`, `TreeItem`, `TreeTableCell`, `TreeTableColumn`, `TreeTableRow`, `TreeTableView`, `TreeView`, `ValueAxis`, `VBox`, `VirtualFlow`, `WebView`, `Window`, `XYChart`

public interface EventTarget
Represents an event target.

Since:
  JavaFX 2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default <E extends Event>
  void`
  `addEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter)`
  Registers an event filter for this target.
  `default <E extends Event>
  void`
  `addEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)`
  Registers an event handler for this target.
  `EventDispatchChain`
  `buildEventDispatchChain(EventDispatchChain tail)`
  Construct an event dispatch chain for this target.
  `default <E extends Event>
  void`
  `removeEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter)`
  Unregisters a previously registered event filter from this target.
  `default <E extends Event>
  void`
  `removeEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)`
  Unregisters a previously registered event handler from this target.

- ## Method Details

  - ### buildEventDispatchChain

    EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
    Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this `EventTarget`. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an `EventDispatcher` for itself to the chain.

    In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.

    The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.

    The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.

    Parameters:
      `tail` - the initial chain to build from
    Returns:
      the resulting event dispatch chain for this target

  - ### addEventHandler

    default <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)
    Registers an event handler for this target.

    The handler is called when the target receives an `Event` of the specified type during the bubbling phase of event delivery.

    Implementation Requirements:
      The default implementation of this method throws `UnsupportedOperationException`.
    Type Parameters:
      `E` - the event class of the handler
    Parameters:
      `eventType` - the type of the events received by the handler
      `eventHandler` - the event handler
    Throws:
      `NullPointerException` - if `eventType` or `eventHandler` is `null`
      `UnsupportedOperationException` - if this target does not support event handlers
    Since:
      21

  - ### removeEventHandler

    default <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)
    Unregisters a previously registered event handler from this target.

    Since it is possible to register a single `EventHandler` instance for different event types, the caller needs to specify the event type from which the handler should be unregistered.

    Implementation Requirements:
      The default implementation of this method throws `UnsupportedOperationException`.
    Type Parameters:
      `E` - the event class of the handler
    Parameters:
      `eventType` - the event type from which to unregister
      `eventHandler` - the event handler
    Throws:
      `NullPointerException` - if `eventType` or `eventHandler` is `null`
      `UnsupportedOperationException` - if this target does not support event handlers
    Since:
      21

  - ### addEventFilter

    default <E extends Event> void addEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter)
    Registers an event filter for this target.

    The filter is called when the target receives an `Event` of the specified type during the capturing phase of event delivery.

    Implementation Requirements:
      The default implementation of this method throws `UnsupportedOperationException`.
    Type Parameters:
      `E` - the event class of the filter
    Parameters:
      `eventType` - the type of the events received by the filter
      `eventFilter` - the event filter
    Throws:
      `NullPointerException` - if `eventType` or `eventFilter` is `null`
      `UnsupportedOperationException` - if this target does not support event filters
    Since:
      21

  - ### removeEventFilter

    default <E extends Event> void removeEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter)
    Unregisters a previously registered event filter from this target.

    Since it is possible to register a single `EventHandler` instance for different event types, the caller needs to specify the event type from which the filter should be unregistered.

    Implementation Requirements:
      The default implementation of this method throws `UnsupportedOperationException`.
    Type Parameters:
      `E` - the event class of the filter
    Parameters:
      `eventType` - the event type from which to unregister
      `eventFilter` - the event filter
    Throws:
      `NullPointerException` - if `eventType` or `eventFilter` is `null`
      `UnsupportedOperationException` - if this target does not support event filters
    Since:
      21