Top Description Fields Constructors Methods
javafx.scene.input

public Class GestureEvent

extends InputEvent
Class Inheritance
Known Direct Subclasses
javafx.scene.input.RotateEvent, javafx.scene.input.ScrollEvent, javafx.scene.input.SwipeEvent, javafx.scene.input.ZoomEvent
Imports
com.sun.javafx.scene.input.InputEventUtils, com.sun.javafx.tk.Toolkit, java.io.IOException, javafx.event.EventTarget, .EventType, javafx.geometry.Point3D

An event indicating gesture input. Gestures are typically caused by direct (touch screen) or indirect (track pad) touch events.

Delivery of gestures is dependent on the capabilities of the underlying platform and connected input devices. For instance on a PC with mouse and keyboard there is no way of producing a rotating gesture.

Since
JavaFX 2.2

Field Summary

Modifier and TypeField and Description
private final boolean
public static final EventType<GestureEvent>
ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all gestures.
private final boolean
private final boolean
private final boolean
private final boolean
private PickResult
pickResult

Information about the pick if the picked Node is a Shape3D node and its pickOnBounds is false.

private final double
private final double
private final double
private final double
private static final long
private final boolean
private transient double
x

private transient double
y

private transient double
z

Depth z position of the event relative to the origin of the MouseEvent's node.

Constructor Summary

AccessConstructor and Description
protected
GestureEvent(final EventType<? extends GestureEvent>
Type of the event
eventType
)
Deprecated since 8. Do not use this constructor. Constructs empty event.

Creates a new instance of GestureEvent.

protected
GestureEvent(Object
Event source
source
,
EventTarget
Event target
target
,
final EventType<? extends GestureEvent>
Type of the event
eventType
)
Deprecated since 8. Do not use this constructor. Constructs empty event.

Creates a new instance of GestureEvent.

protected
GestureEvent(Object
the source of the event. Can be null.
source
,
EventTarget
the target of the event. Can be null.
target
,
final EventType<? extends GestureEvent>
The type of the event.
eventType
,
double
The x with respect to the scene.
x
,
double
The y with respect to the scene.
y
,
double
The x coordinate relative to screen.
screenX
,
double
The y coordinate relative to screen.
screenY
,
boolean
true if shift modifier was pressed.
shiftDown
,
boolean
true if control modifier was pressed.
controlDown
,
boolean
true if alt modifier was pressed.
altDown
,
boolean
true if meta modifier was pressed.
metaDown
,
boolean
true if the event was caused by direct input device. See isDirect()
direct
,
boolean
if represents inertia of an already finished gesture.
inertia
,
PickResult
pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates and the target
pickResult
)

Constructs new GestureEvent event.

protected
GestureEvent(final EventType<? extends GestureEvent>
The type of the event.
eventType
,
double
The x with respect to the scene.
x
,
double
The y with respect to the scene.
y
,
double
The x coordinate relative to screen.
screenX
,
double
The y coordinate relative to screen.
screenY
,
boolean
true if shift modifier was pressed.
shiftDown
,
boolean
true if control modifier was pressed.
controlDown
,
boolean
true if alt modifier was pressed.
altDown
,
boolean
true if meta modifier was pressed.
metaDown
,
boolean
true if the event was caused by direct input device. See isDirect()
direct
,
boolean
if represents inertia of an already finished gesture.
inertia
,
PickResult
pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates
pickResult
)

Constructs new GestureEvent event with empty source and target

Method Summary

Modifier and TypeMethod and Description
public GestureEvent
copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.event.Event.copyFor.

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

public EventType<? extends GestureEvent>
getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Gets the event type of this event.

public final PickResult

Returns:

new PickResult object that contains information about the pick
getPickResult
()

Returns information about the pick.

public final double

Returns:

the horizontal position of the event relative to the origin of the Scene that contains the event's source
getSceneX
()

Gets the horizontal position of the event relative to the origin of the Scene that contains the event's source.

public final double

Returns:

the vertical position of the event relative to the origin of the Scene that contains the event's source
getSceneY
()

Gets the vertical position of the event relative to the origin of the Scene that contains the event's source.

public final double

Returns:

the absolute horizontal position of the event
getScreenX
()

Gets the absolute horizontal position of the event.

public final double

Returns:

the absolute vertical position of the event
getScreenY
()

Gets the absolute vertical position of the event.

public final double

Returns:

the horizontal position of the event relative to the origin of the event's source.
getX
()

Gets the horizontal position of the event relative to the origin of the event's source.

public final double

Returns:

the vertical position of the event relative to the origin of the event's source.
getY
()

Gets the vertical position of the event relative to the origin of the event's source.

public final double

Returns:

depth position of the event relative to the origin of the MouseEvent's source.
getZ
()

Depth position of the event relative to the origin of the MouseEvent's source.

public final boolean

Returns:

true if the Alt modifier is down on this event
isAltDown
()

Indicates whether or not the Alt modifier is down on this event.

public final boolean

Returns:

true if the Control modifier is down on this event
isControlDown
()

Indicates whether or not the Control modifier is down on this event.

public final boolean

Returns:

true if this event is caused by a direct input device
isDirect
()

Indicates whether this gesture is caused by a direct or indirect input device.

public boolean

Returns:

true if this is an inertia event
isInertia
()

Indicates if this event represents an inertia of an already finished gesture.

public final boolean

Returns:

true if the Meta modifier is down on this event
isMetaDown
()

Indicates whether or not the Meta modifier is down on this event.

public final boolean

Returns:

true if the Shift modifier is down on this event
isShiftDown
()

Indicates whether or not the Shift modifier is down on this event.

public final boolean

Returns:

true if the shortcut modifier is down, false otherwise
isShortcutDown
()

Indicates whether or not the host platform common shortcut modifier is down on this event.

private void
private void
recomputeCoordinatesToSource(GestureEvent
Event whose coordinates are to be filled
newEvent
,
Object
Source object to compute coordinates for
newSource
)

Fills the given event by this event's coordinates recomputed to the given source object.

public String

Returns:

a string representation of this GestureEvent object.
toString
()

Overrides java.util.EventObject.toString.

Returns a string representation of this GestureEvent object.

Field Detail

altDownback to summary
private final boolean altDown
Annotations
@SuppressWarnings:doclint:missing
ANYback to summary
public static final EventType<GestureEvent> ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all gestures.

controlDownback to summary
private final boolean controlDown
Annotations
@SuppressWarnings:doclint:missing
directback to summary
private final boolean direct
Annotations
@SuppressWarnings:doclint:missing
inertiaback to summary
private final boolean inertia
Annotations
@SuppressWarnings:doclint:missing
metaDownback to summary
private final boolean metaDown
Annotations
@SuppressWarnings:doclint:missing
pickResultback to summary
private PickResult pickResult

Information about the pick if the picked Node is a Shape3D node and its pickOnBounds is false.

sceneXback to summary
private final double sceneX
Annotations
@SuppressWarnings:doclint:missing
sceneYback to summary
private final double sceneY
Annotations
@SuppressWarnings:doclint:missing
screenXback to summary
private final double screenX
Annotations
@SuppressWarnings:doclint:missing
screenYback to summary
private final double screenY
Annotations
@SuppressWarnings:doclint:missing
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.scene.input.InputEvent.serialVersionUID.

shiftDownback to summary
private final boolean shiftDown
Annotations
@SuppressWarnings:doclint:missing
xback to summary
private transient double x
yback to summary
private transient double y
zback to summary
private transient double z

Depth z position of the event relative to the origin of the MouseEvent's node.

Constructor Detail

GestureEventback to summary
protected GestureEvent(final EventType<? extends GestureEvent> eventType)

Deprecated

since 8.

Do not use this constructor. Constructs empty event.

Creates a new instance of GestureEvent.

Parameters
eventType:EventType<? extends GestureEvent>

Type of the event

Annotations
@Deprecated
since:8
GestureEventback to summary
protected GestureEvent(Object source, EventTarget target, final EventType<? extends GestureEvent> eventType)

Deprecated

since 8.

Do not use this constructor. Constructs empty event.

Creates a new instance of GestureEvent.

Parameters
source:Object

Event source

target:EventTarget

Event target

eventType:EventType<? extends GestureEvent>

Type of the event

Annotations
@Deprecated
since:8
GestureEventback to summary
protected GestureEvent(Object source, EventTarget target, final EventType<? extends GestureEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, PickResult pickResult)

Constructs new GestureEvent event.

Parameters
source:Object

the source of the event. Can be null.

target:EventTarget

the target of the event. Can be null.

eventType:EventType<? extends GestureEvent>

The type of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

shiftDown:boolean

true if shift modifier was pressed.

controlDown:boolean

true if control modifier was pressed.

altDown:boolean

true if alt modifier was pressed.

metaDown:boolean

true if meta modifier was pressed.

direct:boolean

true if the event was caused by direct input device. See isDirect()

inertia:boolean

if represents inertia of an already finished gesture.

pickResult:PickResult

pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates and the target

Since
JavaFX 8.0
GestureEventback to summary
protected GestureEvent(final EventType<? extends GestureEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, PickResult pickResult)

Constructs new GestureEvent event with empty source and target

Parameters
eventType:EventType<? extends GestureEvent>

The type of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

shiftDown:boolean

true if shift modifier was pressed.

controlDown:boolean

true if control modifier was pressed.

altDown:boolean

true if alt modifier was pressed.

metaDown:boolean

true if meta modifier was pressed.

direct:boolean

true if the event was caused by direct input device. See isDirect()

inertia:boolean

if represents inertia of an already finished gesture.

pickResult:PickResult

pick result. Can be null, in this case a 2D pick result without any further values is constructed based on the scene coordinates

Since
JavaFX 8.0

Method Detail

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

Overrides javafx.event.Event.copyFor.

Doc from javafx.event.Event.copyFor.

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.

Annotations
@Override
getEventTypeback to summary
public EventType<? extends GestureEvent> getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Doc from javafx.event.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.

Annotations
@Override
getPickResultback to summary
public final PickResult getPickResult()

Returns information about the pick.

Returns:PickResult

new PickResult object that contains information about the pick

Since
JavaFX 8.0
getSceneXback to summary
public final double getSceneX()

Gets the horizontal position of the event relative to the origin of the Scene that contains the event's source. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the event's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

the horizontal position of the event relative to the origin of the Scene that contains the event's source

See Also
isDirect()
getSceneYback to summary
public final double getSceneY()

Gets the vertical position of the event relative to the origin of the Scene that contains the event's source. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the event's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

the vertical position of the event relative to the origin of the Scene that contains the event's source

See Also
isDirect()
getScreenXback to summary
public final double getScreenX()

Gets the absolute horizontal position of the event.

Returns:double

the absolute horizontal position of the event

See Also
isDirect()
getScreenYback to summary
public final double getScreenY()

Gets the absolute vertical position of the event.

Returns:double

the absolute vertical position of the event

See Also
isDirect()
getXback to summary
public final double getX()

Gets the horizontal position of the event relative to the origin of the event's source.

Returns:double

the horizontal position of the event relative to the origin of the event's source.

See Also
isDirect()
getYback to summary
public final double getY()

Gets the vertical position of the event relative to the origin of the event's source.

Returns:double

the vertical position of the event relative to the origin of the event's source.

See Also
isDirect()
getZback to summary
public final double getZ()

Depth position of the event relative to the origin of the MouseEvent's source.

Returns:double

depth position of the event relative to the origin of the MouseEvent's source.

Since
JavaFX 8.0
isAltDownback to summary
public final boolean isAltDown()

Indicates whether or not the Alt modifier is down on this event.

Returns:boolean

true if the Alt modifier is down on this event

isControlDownback to summary
public final boolean isControlDown()

Indicates whether or not the Control modifier is down on this event.

Returns:boolean

true if the Control modifier is down on this event

isDirectback to summary
public final boolean isDirect()

Indicates whether this gesture is caused by a direct or indirect input device. With direct input device the gestures are performed directly at the concrete coordinates, a typical example would be a touch screen. With indirect device the gestures are performed indirectly and usually mouse cursor position is used as the gesture coordinates, a typical example would be a track pad.

Returns:boolean

true if this event is caused by a direct input device

isInertiaback to summary
public boolean isInertia()

Indicates if this event represents an inertia of an already finished gesture.

Returns:boolean

true if this is an inertia event

isMetaDownback to summary
public final boolean isMetaDown()

Indicates whether or not the Meta modifier is down on this event.

Returns:boolean

true if the Meta modifier is down on this event

isShiftDownback to summary
public final boolean isShiftDown()

Indicates whether or not the Shift modifier is down on this event.

Returns:boolean

true if the Shift modifier is down on this event

isShortcutDownback to summary
public final boolean isShortcutDown()

Indicates whether or not the host platform common shortcut modifier is down on this event. This common shortcut modifier is a modifier key which is used commonly in shortcuts on the host platform. It is for example control on Windows and meta (command key) on Mac.

Returns:boolean

true if the shortcut modifier is down, false otherwise

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides javafx.event.Event.readObject.

Annotations
@SuppressWarnings:doclint:missing
recomputeCoordinatesToSourceback to summary
private void recomputeCoordinatesToSource(GestureEvent newEvent, Object newSource)

Fills the given event by this event's coordinates recomputed to the given source object.

Parameters
newEvent:GestureEvent

Event whose coordinates are to be filled

newSource:Object

Source object to compute coordinates for

toStringback to summary
public String toString()

Overrides java.util.EventObject.toString.

Returns a string representation of this GestureEvent object.

Returns:String

a string representation of this GestureEvent object.

Annotations
@Override