Top Description Methods
javafx.event

public Interface EventTarget

Known Direct Subinterfaces
com.sun.javafx.event.CompositeEventTarget

Represents an event target.
Since
JavaFX 2.0

Method Summary

Modifier and TypeMethod and Description
public default <
the event class of the filter
E extends Event
>
void
addEventFilter(EventType<E>
the type of the events received by the filter
eventType
,
EventHandler<? super E>
the event filter
eventFilter
)

Registers an event filter for this target.

public default <
the event class of the handler
E extends Event
>
void
addEventHandler(EventType<E>
the type of the events received by the handler
eventType
,
EventHandler<? super E>
the event handler
eventHandler
)

Registers an event handler for this target.

public EventDispatchChain

Returns:

the resulting event dispatch chain for this target
buildEventDispatchChain
(EventDispatchChain
the initial chain to build from
tail
)

Construct an event dispatch chain for this target.

public default <
the event class of the filter
E extends Event
>
void
removeEventFilter(EventType<E>
the event type from which to unregister
eventType
,
EventHandler<? super E>
the event filter
eventFilter
)

Unregisters a previously registered event filter from this target.

public default <
the event class of the handler
E extends Event
>
void
removeEventHandler(EventType<E>
the event type from which to unregister
eventType
,
EventHandler<? super E>
the event handler
eventHandler
)

Unregisters a previously registered event handler from this target.

Method Detail

addEventFilterback to summary
public 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 Specification

The default implementation of this method throws UnsupportedOperationException.

Parameters
<E>
the event class of the filter
eventType:EventType<E>

the type of the events received by the filter

eventFilter:EventHandler<? super E>

the event filter

Exceptions
NullPointerException:
if eventType or eventFilter is null
UnsupportedOperationException:
if this target does not support event filters
Since
21
addEventHandlerback to summary
public 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 Specification

The default implementation of this method throws UnsupportedOperationException.

Parameters
<E>
the event class of the handler
eventType:EventType<E>

the type of the events received by the handler

eventHandler:EventHandler<? super E>

the event handler

Exceptions
NullPointerException:
if eventType or eventHandler is null
UnsupportedOperationException:
if this target does not support event handlers
Since
21
buildEventDispatchChainback to summary
public 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:EventDispatchChain

the initial chain to build from

Returns:EventDispatchChain

the resulting event dispatch chain for this target

removeEventFilterback to summary
public 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 Specification

The default implementation of this method throws UnsupportedOperationException.

Parameters
<E>
the event class of the filter
eventType:EventType<E>

the event type from which to unregister

eventFilter:EventHandler<? super E>

the event filter

Exceptions
NullPointerException:
if eventType or eventFilter is null
UnsupportedOperationException:
if this target does not support event filters
Since
21
removeEventHandlerback to summary
public 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 Specification

The default implementation of this method throws UnsupportedOperationException.

Parameters
<E>
the event class of the handler
eventType:EventType<E>

the event type from which to unregister

eventHandler:EventHandler<? super E>

the event handler

Exceptions
NullPointerException:
if eventType or eventHandler is null
UnsupportedOperationException:
if this target does not support event handlers
Since
21