Spec-Zone.ru › OpenJavaFX 8
javafx.scene.input

Class SwipeEvent

java.lang.Object
  • java.util.EventObject
    • javafx.event.Event
      • javafx.scene.input.InputEvent
        • javafx.scene.input.GestureEvent
          • javafx.scene.input.SwipeEvent

All Implemented Interfaces:

Serializable, Cloneable



public final class SwipeEvent
extends GestureEvent
Swipe event indicates that user performed a swipe gesture such as dragging a finger in one direction on touch screen.

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 Summary

    Fields
    Modifier and Type Field and Description
    static EventType<SwipeEvent> ANY
    Common supertype for all swipe event types.
    static EventType<SwipeEvent> SWIPE_DOWN
    This event occurs when user performs downward swipe gesture.
    static EventType<SwipeEvent> SWIPE_LEFT
    This event occurs when user performs leftward swipe gesture.
    static EventType<SwipeEvent> SWIPE_RIGHT
    This event occurs when user performs rightward swipe gesture.
    static EventType<SwipeEvent> SWIPE_UP
    This event occurs when user performs upward swipe gesture.
    • Fields inherited from class javafx.event.Event

      consumed, eventType, NULL_SOURCE_TARGET, target
    • Fields inherited from class java.util.EventObject

      source
  • Constructor Summary

    Constructors
    Constructor and Description
    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.
    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.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    SwipeEvent copyFor(Object newSource, EventTarget newTarget)
    Creates and returns a copy of this event with the specified event source and target.
    SwipeEvent copyFor(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.
    int getTouchCount()
    Gets number of touch points that caused this event.
    String toString()
    Returns a string representation of this SwipeEvent object.
    • Methods inherited from class javafx.scene.input.GestureEvent

      getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown
    • Methods inherited from class javafx.event.Event

      clone, consume, fireEvent, getTarget, isConsumed
    • Methods inherited from class java.util.EventObject

      getSource
    • Methods inherited from class java.lang.Object

      equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Detail

    • ANY

      public static final EventType<SwipeEvent> ANY
      Common supertype for all swipe event types.
    • SWIPE_LEFT

      public static final EventType<SwipeEvent> SWIPE_LEFT
      This event occurs when user performs leftward swipe gesture.
    • SWIPE_RIGHT

      public static final EventType<SwipeEvent> SWIPE_RIGHT
      This event occurs when user performs rightward swipe gesture.
    • SWIPE_UP

      public static final EventType<SwipeEvent> SWIPE_UP
      This event occurs when user performs upward swipe gesture.
    • SWIPE_DOWN

      public static final EventType<SwipeEvent> SWIPE_DOWN
      This event occurs when user performs downward swipe gesture.
  • Constructor Detail

    • SwipeEvent

      public 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.

      Since:

      JavaFX 8.0

    • SwipeEvent

      public 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.

      Since:

      JavaFX 8.0

  • Method Detail

    • getTouchCount

      public int getTouchCount()
      Gets number of touch points that caused this event.

      Returns:

      Number of touch points that caused this event

    • toString

      public String toString()
      Returns a string representation of this SwipeEvent object.

      Overrides:

      toString in class GestureEvent

      Returns:

      a string representation of this SwipeEvent object.

    • copyFor

      public SwipeEvent copyFor(Object newSource,
                                EventTarget newTarget)
      Description copied from class: Event
      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.

      Overrides:

      copyFor in class GestureEvent

      Parameters:

      newSource - the new source of the copied event

      Returns:

      the event copy with the new source and target

    • copyFor

      public SwipeEvent copyFor(Object newSource,
                                EventTarget newTarget,
                                EventType<SwipeEvent> type)
      Creates a copy of the given event with the given fields substituted.

      Parameters:

      source - the new source of the copied event

      Returns:

      the event copy with the fields substituted

      Since:

      JavaFX 8.0

    • getEventType

      public EventType<SwipeEvent> getEventType()
      Description copied from class: Event
      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.

      Overrides:

      getEventType in class GestureEvent

      Returns:

      the event type

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API