Unlike some other gestures, the swipe gesture is not continual - the whole gesture produces only one event. The event is delivered to the top-most node picked on the gesture coordinates.
The swipe gesture has four types according to the movement direction.
The gesture can be performed by any number of touch points, the number
is provided by getTouchCount() method.
Note that swipe and scroll gestures are not exclusive. A single touch screen action can result in both gestures being delivered.
Note that the capability to produce swipes is dependent on the used input devices and underlying platform's capabilities and settings (especially without touch-screen user's possibilities of producing swipes are significantly reduced).
As all gestures, swipe can be direct (performed directly at the concrete coordinates as on touch screen - the center of the gesture is used as gesture coordinates) or indirect (performed indirectly as on track pad - the mouse cursor location is usually used as the gesture coordinates in this case).
| Modifier and Type | Field and Description |
|---|---|
| public static final EventType | ANY
Common supertype for all swipe event types.
|
| private static final long | |
| public static final EventType | SWIPE_DOWN
This event occurs when user performs downward swipe gesture. |
| public static final EventType | SWIPE_LEFT
This event occurs when user performs leftward swipe gesture. |
| public static final EventType | SWIPE_RIGHT
This event occurs when user performs rightward swipe gesture. |
| public static final EventType | SWIPE_UP
This event occurs when user performs upward swipe gesture. |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | SwipeEvent(Object
the source of the event. Can be null. source, EventTarget the target of the event. Can be null. target, final EventType<SwipeEvent> 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 direct, int isDirect()number of touch points touchCount, 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 SwipeEvent event. |
| public | SwipeEvent(final EventType<SwipeEvent>
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 direct, int isDirect()number of touch points touchCount, 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 SwipeEvent event with null source and target. |
| Modifier and Type | Method and Description |
|---|---|
| public SwipeEvent | copyFor(Object
the new source of the copied event newSource, EventTarget the new target of the copied event newTarget)Overrides javafx. Creates and returns a copy of this event with the specified event source and target. |
| public SwipeEvent | Returns: the event copy with the fields substitutedthe new source of the copied event newSource, EventTarget the new target of the copied event newTarget, EventType<SwipeEvent> the new eventType type)Creates a copy of the given event with the given fields substituted. |
| public EventType | getEventType()
Overrides javafx. Gets the event type of this event. |
| public int | Returns: Number of touch points that caused this eventGets number of touch points that caused this event. |
| public String | Returns: a string representation of thisSwipeEvent object.Overrides javafx. Returns a string representation of this |
| ANY | back to summary |
|---|---|
| public static final EventType<SwipeEvent> ANY Hides javafx. Common supertype for all swipe event types. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| SWIPE_DOWN | back to summary |
|---|---|
| public static final EventType<SwipeEvent> SWIPE_DOWN This event occurs when user performs downward swipe gesture. | |
| SWIPE_LEFT | back to summary |
|---|---|
| public static final EventType<SwipeEvent> SWIPE_LEFT This event occurs when user performs leftward swipe gesture. | |
| SWIPE_RIGHT | back to summary |
|---|---|
| public static final EventType<SwipeEvent> SWIPE_RIGHT This event occurs when user performs rightward swipe gesture. | |
| SWIPE_UP | back to summary |
|---|---|
| public static final EventType<SwipeEvent> SWIPE_UP This event occurs when user performs upward swipe gesture. | |
| touchCount | back to summary |
|---|---|
private final int touchCount
| |
| SwipeEvent | back to summary |
|---|---|
| public SwipeEvent(Object source, EventTarget target, final EventType<SwipeEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, int touchCount, PickResult pickResult) Constructs new SwipeEvent event.
| |
| SwipeEvent | back to summary |
|---|---|
| public SwipeEvent(final EventType<SwipeEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, int touchCount, PickResult pickResult) Constructs new SwipeEvent event with null source and target.
| |
| copyFor | back to summary |
|---|---|
| public SwipeEvent copyFor(Object newSource, EventTarget newTarget) Overrides javafx. Doc from javafx. Creates and returns a copy of this event with the specified event source
and target. If the source or target is set to
| |
| copyFor | back to summary |
|---|---|
| public SwipeEvent copyFor(Object newSource, EventTarget newTarget, EventType<SwipeEvent> type) Creates a copy of the given event with the given fields substituted.
| |
| getEventType | back to summary |
|---|---|
| public EventType Overrides javafx. Doc from javafx. Gets the event type of this event. Objects of the same
| |
| getTouchCount | back to summary |
|---|---|
| public int getTouchCount() Gets number of touch points that caused this event.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides javafx. Returns a string representation of this | |