Top Description Inners Fields Constructors Methods
javafx.scene.input

public final Class TouchPoint

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.sun.javafx.scene.input.InputEventUtils, .TouchPointHelper, java.io.IOException, .Serializable, javafx.beans.NamedArg, javafx.event.EventTarget, javafx.geometry.Point3D, javafx.scene.Node, .Scene

Touch point represents a single point of a multi-touch action, typically one finger touching a screen. It is contained in TouchEvent.

The touch point has its coordinates, state (see State) and ID. The ID is sequential number of this touch point unique in scope of a single multi-touch gesture.

Each touch point is by default delivered to a single node during its whole trajectory - to the node on which it was pressed. There is a grabbing API to modify this behavior. The above means that when touch point is pressed, it is automatically grabbed by the top-most node on the press coordinates. Any time during the gesture grab() and ungrab() methods can be used to alter the event delivery target. When grabbed by a different node, it will next time be targeted to it; when ungrabbed, it will be always targeted to the top-most node on the current location.

Since
JavaFX 2.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
TouchPoint.State

Represents current state of the touch point

Field Summary

Modifier and TypeField and Description
private EventTarget
private int
private PickResult
pickResult

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

private double
private double
private double
private double
private transient Object
private TouchPoint.State
private transient EventTarget
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
public
TouchPoint(int
ID of the new touch point
id
,
TouchPoint.State
state of the new touch point
state
,
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
,
EventTarget
Node or other event target.
target
,
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 target
pickResult
)

Creates new instance of TouchPoint.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this touch point is targeted to the given target or some of its children
belongsTo
(EventTarget
Node or other event target to be tested
target
)

Distinguishes between touch points targeted to the given node or some of its children from touch points targeted somewhere else.

public EventTarget

Returns:

The current grabbed target, null if the touch point is ungrabbed
getGrabbed
()

Gets event target which has grabbed this touch point.

public final int

Returns:

the identifier of this touch point.
getId
()

Gets identifier of this touch point.

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 touch point relative to the origin of the Scene that contains the TouchEvent's source
getSceneX
()

Gets the horizontal position of the touch point relative to the origin of the Scene that contains the TouchEvent's source.

public final double

Returns:

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

Gets the vertical position of the touch point relative to the origin of the Scene that contains the TouchEvent's source.

public final double

Returns:

the absolute horizontal position of the touch point
getScreenX
()

Gets the absolute horizontal position of the touch point.

public final double

Returns:

the absolute vertical position of the touch point
getScreenY
()

Gets the absolute vertical position of the touch point.

public final TouchPoint.State

Returns:

state of this touch point
getState
()

Gets state of this touch point

public EventTarget

Returns:

Event target for this touch point
getTarget
()

Gets event target on which the touch event carrying this touch point is fired.

public final double

Returns:

the horizontal position of the touch point relative to the origin of the TouchEvent's source.
getX
()

Gets the horizontal position of the touch point relative to the origin of the TouchEvent's source.

public final double

Returns:

the vertical position of the touch point relative to the origin of the TouchEvent's source.
getY
()

Gets the vertical position of the touch point relative to the origin of the TouchEvent'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 void
grab()

Grabs this touch point by current event source.

public void
grab(EventTarget
Target by which to grab the touch point
target
)

Grabs this touch point by the given target.

private void
pack-priv void
recomputeToSource(Object
Source object of the current values
oldSource
,
Object
Source object to compute values for
newSource
)

Recomputes this touch point (coordinates, relevancy) for the given event source object.

pack-priv void
public String

Returns:

a string representation of this TouchPoint object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this TouchPoint object.

public void
ungrab()

Ungrabs this touch point from its target.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

grabbedback to summary
private EventTarget grabbed
Annotations
@SuppressWarnings:doclint:missing
idback to summary
private int id
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 double sceneX
Annotations
@SuppressWarnings:doclint:missing
sceneYback to summary
private double sceneY
Annotations
@SuppressWarnings:doclint:missing
screenXback to summary
private double screenX
Annotations
@SuppressWarnings:doclint:missing
screenYback to summary
private double screenY
Annotations
@SuppressWarnings:doclint:missing
sourceback to summary
private transient Object source
stateback to summary
private TouchPoint.State state
Annotations
@SuppressWarnings:doclint:missing
targetback to summary
private transient EventTarget target
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

TouchPointback to summary
public TouchPoint(int id, TouchPoint.State state, double x, double y, double screenX, double screenY, EventTarget target, PickResult pickResult)

Creates new instance of TouchPoint.

Parameters
id:int

ID of the new touch point

state:TouchPoint.State

state of the new touch point

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.

target:EventTarget

Node or other event target.

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 target

Since
JavaFX 8.0

Method Detail

belongsToback to summary
public boolean belongsTo(EventTarget target)

Distinguishes between touch points targeted to the given node or some of its children from touch points targeted somewhere else. This allows for testing all touch points carried by one touch event on their relevance for a given node.

Parameters
target:EventTarget

Node or other event target to be tested

Returns:boolean

true if this touch point is targeted to the given target or some of its children

getGrabbedback to summary
public EventTarget getGrabbed()

Gets event target which has grabbed this touch point.

Returns:EventTarget

The current grabbed target, null if the touch point is ungrabbed

getIdback to summary
public final int getId()

Gets identifier of this touch point. The number is sequential and unique in scope of one multi touch gesture. The first pressed touch point has id 1, each subsequently pressed touch points gets the next ordinal number until all touch points are released and the counter is reset.

Returns:int

the identifier of this touch point.

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 touch point relative to the origin of the Scene that contains the TouchEvent'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 TouchEvent's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

the horizontal position of the touch point relative to the origin of the Scene that contains the TouchEvent's source

getSceneYback to summary
public final double getSceneY()

Gets the vertical position of the touch point relative to the origin of the Scene that contains the TouchEvent'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 TouchEvent's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

the vertical position of the touch point relative to the origin of the Scene that contains the TouchEvent's source

getScreenXback to summary
public final double getScreenX()

Gets the absolute horizontal position of the touch point.

Returns:double

the absolute horizontal position of the touch point

getScreenYback to summary
public final double getScreenY()

Gets the absolute vertical position of the touch point.

Returns:double

the absolute vertical position of the touch point

getStateback to summary
public final TouchPoint.State getState()

Gets state of this touch point

Returns:TouchPoint.State

state of this touch point

getTargetback to summary
public EventTarget getTarget()

Gets event target on which the touch event carrying this touch point is fired.

Returns:EventTarget

Event target for this touch point

getXback to summary
public final double getX()

Gets the horizontal position of the touch point relative to the origin of the TouchEvent's source.

Returns:double

the horizontal position of the touch point relative to the origin of the TouchEvent's source.

getYback to summary
public final double getY()

Gets the vertical position of the touch point relative to the origin of the TouchEvent's source.

Returns:double

the vertical position of the touch point relative to the origin of the TouchEvent's source.

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
grabback to summary
public void grab()

Grabs this touch point by current event source. Next event containing this touch point will be targeted to the same node whose event handler called this method.

grabback to summary
public void grab(EventTarget target)

Grabs this touch point by the given target. Next event containing this touch point will be targeted to it.

Parameters
target:EventTarget

Target by which to grab the touch point

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
Annotations
@SuppressWarnings:doclint:missing
recomputeToSourceback to summary
pack-priv void recomputeToSource(Object oldSource, Object newSource)

Recomputes this touch point (coordinates, relevancy) for the given event source object.

Parameters
oldSource:Object

Source object of the current values

newSource:Object

Source object to compute values for

resetback to summary
pack-priv void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this TouchPoint object.

Returns:String

a string representation of this TouchPoint object.

Annotations
@Override
ungrabback to summary
public void ungrab()

Ungrabs this touch point from its target. Since the next event this touch point will be delivered to the top-most node picked on its respective location until it is grabbed again or released.

javafx.scene.input back to summary

public final Enum TouchPoint.State

extends Enum<TouchPoint.State>
Class Inheritance

Represents current state of the touch point
Since
JavaFX 2.2

Field Summary

Modifier and TypeField and Description
public static final TouchPoint.State
MOVED

The touch point has been moved

public static final TouchPoint.State
PRESSED

The touch point has just been pressed (touched for the first time)

public static final TouchPoint.State
RELEASED

The touch point has been released

public static final TouchPoint.State
STATIONARY

The touch point remains pressed and still (without moving)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TouchPoint.State
public static TouchPoint.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

MOVEDback to summary
public static final TouchPoint.State MOVED

The touch point has been moved

PRESSEDback to summary
public static final TouchPoint.State PRESSED

The touch point has just been pressed (touched for the first time)

RELEASEDback to summary
public static final TouchPoint.State RELEASED

The touch point has been released

STATIONARYback to summary
public static final TouchPoint.State STATIONARY

The touch point remains pressed and still (without moving)

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static TouchPoint.State valueOf(String name)
valuesback to summary
public static TouchPoint.State[] values()