- All Implemented Interfaces:
- Serializable,- Cloneable
public final class SwipeEvent extends GestureEvent
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).
- Since:
- JavaFX 2.2
- See Also:
- Serialized Form
- 
Field SummaryFields Modifier and Type Field Description static EventType<SwipeEvent>ANYCommon supertype for all swipe event types.static EventType<SwipeEvent>SWIPE_DOWNThis event occurs when user performs downward swipe gesture.static EventType<SwipeEvent>SWIPE_LEFTThis event occurs when user performs leftward swipe gesture.static EventType<SwipeEvent>SWIPE_RIGHTThis event occurs when user performs rightward swipe gesture.static EventType<SwipeEvent>SWIPE_UPThis event occurs when user performs upward swipe gesture.
- 
Constructor SummaryConstructors Constructor Description SwipeEvent(Object source, EventTarget target, 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(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.
- 
Method SummaryModifier and Type Method Description SwipeEventcopyFor(Object newSource, EventTarget newTarget)Creates and returns a copy of this event with the specified event source and target.SwipeEventcopyFor(Object newSource, EventTarget newTarget, EventType<SwipeEvent> type)Creates a copy of the given event with the given fields substituted.EventType<SwipeEvent>getEventType()Gets the event type of this event.intgetTouchCount()Gets number of touch points that caused this event.StringtoString()Returns a string representation of thisSwipeEventobject.Methods inherited from class javafx.scene.input.GestureEventgetPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown
- 
Field Details- 
ANYCommon supertype for all swipe event types.
- 
SWIPE_LEFTThis event occurs when user performs leftward swipe gesture.
- 
SWIPE_RIGHTThis event occurs when user performs rightward swipe gesture.
- 
SWIPE_UPThis event occurs when user performs upward swipe gesture.
- 
SWIPE_DOWNThis event occurs when user performs downward swipe gesture.
 
- 
- 
Constructor Details- 
SwipeEventpublic SwipeEvent(Object source, EventTarget target, 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.- Parameters:
- source- the source of the event. Can be null.
- target- the target of the event. Can be null.
- eventType- The type of the event.
- x- The x with respect to the scene.
- y- The y with respect to the scene.
- screenX- The x coordinate relative to screen.
- screenY- The y coordinate relative to screen.
- shiftDown- true if shift modifier was pressed.
- controlDown- true if control modifier was pressed.
- altDown- true if alt modifier was pressed.
- metaDown- true if meta modifier was pressed.
- direct- true if the event was caused by direct input device. See- GestureEvent.isDirect()
- touchCount- number of touch points
- 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
 
- 
SwipeEventpublic SwipeEvent(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.- Parameters:
- eventType- The type of the event.
- x- The x with respect to the scene.
- y- The y with respect to the scene.
- screenX- The x coordinate relative to screen.
- screenY- The y coordinate relative to screen.
- shiftDown- true if shift modifier was pressed.
- controlDown- true if control modifier was pressed.
- altDown- true if alt modifier was pressed.
- metaDown- true if meta modifier was pressed.
- direct- true if the event was caused by direct input device. See- GestureEvent.isDirect()
- touchCount- number of touch points
- 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 Details- 
getTouchCountpublic int getTouchCount()Gets number of touch points that caused this event.- Returns:
- Number of touch points that caused this event
 
- 
toStringReturns a string representation of thisSwipeEventobject.- Overrides:
- toStringin class- GestureEvent
- Returns:
- a string representation of this SwipeEventobject.
 
- 
copyForDescription copied from class:GestureEventCreates and returns a copy of this event with the specified event source and target. If the source or target is set tonull, it is replaced by theNULL_SOURCE_TARGETvalue.- Overrides:
- copyForin class- GestureEvent
- Parameters:
- newSource- the new source of the copied event
- newTarget- the new target of the copied event
- Returns:
- the event copy with the new source and target
 
- 
copyForCreates a copy of the given event with the given fields substituted.- Parameters:
- newSource- the new source of the copied event
- newTarget- the new target of the copied event
- type- the new eventType
- Returns:
- the event copy with the fields substituted
- Since:
- JavaFX 8.0
 
- 
getEventTypeDescription copied from class:EventGets the event type of this event. Objects of the sameEventclass can have different event types. These event types further specify what kind of event occurred.- Overrides:
- getEventTypein class- GestureEvent
- Returns:
- the event type
 
 
-