Top Description Fields Constructors Methods
javafx.event

public Class Event

extends EventObject
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
com.sun.javafx.event.DirectEvent, com.sun.javafx.event.RedirectedEvent, javafx.event.ActionEvent
Imports
java.util.EventObject, com.sun.javafx.event.EventUtil, java.io.IOException, javafx.beans.NamedArg

Base class for FX events. Each FX event has associated an event source, event target and an event type. The event source specifies for an event handler the object on which that handler has been registered and which sent the event to it. The event target defines the path through which the event will travel when posted. The event type provides additional classification to events of the same Event class.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
public static final EventType<Event>
ANY

Common supertype for all event types.

protected boolean
consumed

Whether this event has been consumed by any filter or handler.

protected EventType<? extends Event>
eventType

Type of the event.

public static final EventTarget
NULL_SOURCE_TARGET

The constant which represents an unknown event source / target.

private static final long
protected transient EventTarget
target

Event target that defines the path through which the event will travel when posted.

Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
Event(final EventType<? extends Event>
the event type
eventType
)

Construct a new Event with the specified event type.

public
Event(final Object
the event source which sent the event
source
,
final EventTarget
the event target to associate with the event
target
,
final EventType<? extends Event>
the event type
eventType
)

Construct a new Event with the specified event source, target and type.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a new instance of Event with all values copied from this Event.
clone
()

Overrides java.lang.Object.clone.

Creates and returns a copy of this Event.

public void
consume()

Marks this Event as consumed.

public Event

Returns:

the event copy with the new source and target
copyFor
(final Object
the new source of the copied event
newSource
,
final EventTarget
the new target of the copied event
newTarget
)

Creates and returns a copy of this event with the specified event source and target.

public static void
fireEvent(EventTarget
the target for the event
eventTarget
,
Event
the event to fire
event
)

Fires the specified event.

public EventType<? extends Event>

Returns:

the event type
getEventType
()

Gets the event type of this event.

public EventTarget

Returns:

the event target
getTarget
()

Returns the event target of this event.

public boolean

Returns:

true if this Event has been consumed, false otherwise
isConsumed
()

Indicates whether this Event has been consumed by any filter or handler.

private void
Inherited from java.util.EventObject:
getSourcetoString

Field Detail

ANYback to summary
public static final EventType<Event> ANY

Common supertype for all event types.

consumedback to summary
protected boolean consumed

Whether this event has been consumed by any filter or handler.

eventTypeback to summary
protected EventType<? extends Event> eventType

Type of the event.

NULL_SOURCE_TARGETback to summary
public static final EventTarget NULL_SOURCE_TARGET

The constant which represents an unknown event source / target.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.EventObject.serialVersionUID.

targetback to summary
protected transient EventTarget target

Event target that defines the path through which the event will travel when posted.

Constructor Detail

Eventback to summary
public Event(final EventType<? extends Event> eventType)

Construct a new Event with the specified event type. The source and target of the event is set to NULL_SOURCE_TARGET.

Parameters
eventType:EventType<? extends Event>

the event type

Eventback to summary
public Event(final Object source, final EventTarget target, final EventType<? extends Event> eventType)

Construct a new Event with the specified event source, target and type. If the source or target is set to null, it is replaced by the NULL_SOURCE_TARGET value.

Parameters
source:Object

the event source which sent the event

target:EventTarget

the event target to associate with the event

eventType:EventType<? extends Event>

the event type

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this Event.

Returns:Object

a new instance of Event with all values copied from this Event.

Annotations
@Override
consumeback to summary
public void consume()

Marks this Event as consumed. This stops its further propagation.

copyForback to summary
public Event copyFor(final Object newSource, final EventTarget newTarget)

Creates and returns a copy of this event with the specified event source and target. If the source or target is set to null, it is replaced by the NULL_SOURCE_TARGET value.

Parameters
newSource:Object

the new source of the copied event

newTarget:EventTarget

the new target of the copied event

Returns:Event

the event copy with the new source and target

fireEventback to summary
public static void fireEvent(EventTarget eventTarget, Event event)

Fires the specified event. The given event target specifies the path through which the event will travel.

Parameters
eventTarget:EventTarget

the target for the event

event:Event

the event to fire

Exceptions
NullPointerException:
if eventTarget or event is null
getEventTypeback to summary
public EventType<? extends Event> getEventType()

Gets the event type of this event. Objects of the same Event class can have different event types. These event types further specify what kind of event occurred.

Returns:EventType<? extends Event>

the event type

getTargetback to summary
public EventTarget getTarget()

Returns the event target of this event. The event target specifies the path through which the event will travel when posted.

Returns:EventTarget

the event target

isConsumedback to summary
public boolean isConsumed()

Indicates whether this Event has been consumed by any filter or handler.

Returns:boolean

true if this Event has been consumed, false otherwise

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
Annotations
@SuppressWarnings:doclint:missing