Spec-Zone.ru › OpenJavaFX 24

Class RotateEvent

java.lang.Object
java.util.EventObject
javafx.event.Event
javafx.scene.input.InputEvent
javafx.scene.input.GestureEvent
javafx.scene.input.RotateEvent
All Implemented Interfaces:
Serializable, Cloneable
public final class RotateEvent extends GestureEvent
Rotate event indicates that user performed rotating gesture such as dragging two fingers around each other on track pad, touch screen or other similar device.

The event is delivered to the top-most node picked on the gesture coordinates in time of the gesture start - the whole gesture is delivered to the same node even if the coordinates change during the gesture.

The event provides two values: angle is the rotation angle of this event, totalAngle is the rotation angle of the whole gesture. Both values are in degrees and work well when added to the node's rotate property value (positive values for clockwise rotation).

As all gestures, rotation can be direct (performed directly at the concrete coordinates as on touch screen - the center point among all the touches is usually used as the gesture coordinates) or indirect (performed indirectly as on track pad - the mouse cursor location is usually used as the gesture coordinates).

The gesture's ROTATE events are surrounded by ROTATION_STARTED and ROTATION_FINISHED events. If rotation inertia is active on the given platform, some ROTATE events with isInertia() returning true can come after ROTATION_FINISHED.

Since:
JavaFX 2.2
See Also:
  • Serialized Form

Field Summary

Modifier and Type Field Description
static final EventType<RotateEvent> ANY
Common supertype for all rotate event types.
static final EventType<RotateEvent> ROTATE
This event occurs when user performs a rotating gesture such as dragging two fingers around each other.
static final EventType<RotateEvent> ROTATION_FINISHED
This event occurs when a rotating gesture ends.
static final EventType<RotateEvent> ROTATION_STARTED
This event occurs when a rotating gesture is detected.

Fields declared in class javafx.event.Event

consumed, eventType, NULL_SOURCE_TARGET, target

Fields declared in class java.util.EventObject

source

Constructor Summary

Constructor Description
RotateEvent(Object source, EventTarget target, EventType<RotateEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double angle, double totalAngle, PickResult pickResult)
Constructs new RotateEvent event.
RotateEvent(EventType<RotateEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double angle, double totalAngle, PickResult pickResult)
Constructs new RotateEvent event with null source and target

Method Summary

Modifier and Type Method Description
RotateEvent copyFor(Object newSource, EventTarget newTarget)
Creates and returns a copy of this event with the specified event source and target.
RotateEvent copyFor(Object newSource, EventTarget newTarget, EventType<RotateEvent> type)
Creates a copy of the given event with the given fields substituted.
double getAngle()
Gets the rotation angle of this event.
EventType<RotateEvent> getEventType()
Gets the event type of this event.
double getTotalAngle()
Gets the cumulative rotation angle of this gesture.
String toString()
Returns a string representation of this RotateEvent object.

Methods declared in class javafx.scene.input.GestureEvent

getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown

Methods declared in class javafx.event.Event

clone, consume, fireEvent, getTarget, isConsumed

Methods declared in class java.util.EventObject

getSource

Methods declared in class java.lang.Object

equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Details

ANY

public static final EventType<RotateEvent> ANY
Common supertype for all rotate event types.

ROTATE

public static final EventType<RotateEvent> ROTATE
This event occurs when user performs a rotating gesture such as dragging two fingers around each other.

ROTATION_STARTED

public static final EventType<RotateEvent> ROTATION_STARTED
This event occurs when a rotating gesture is detected.

ROTATION_FINISHED

public static final EventType<RotateEvent> ROTATION_FINISHED
This event occurs when a rotating gesture ends.

Constructor Details

RotateEvent

public RotateEvent(Object source, EventTarget target, EventType<RotateEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double angle, double totalAngle, PickResult pickResult)
Constructs new RotateEvent 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()
inertia - if represents inertia of an already finished gesture.
angle - the rotational angle
totalAngle - the cumulative rotational angle
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

RotateEvent

public RotateEvent(EventType<RotateEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, double angle, double totalAngle, PickResult pickResult)
Constructs new RotateEvent 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()
inertia - if represents inertia of an already finished gesture.
angle - the rotational angle
totalAngle - the cumulative rotational angle
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

getAngle

public double getAngle()
Gets the rotation angle of this event. The angle is in degrees and work well when added to the node's rotate property value (positive values for clockwise rotation).
Returns:
The rotation angle of this event

getTotalAngle

public double getTotalAngle()
Gets the cumulative rotation angle of this gesture. The angle is in degrees and work well when added to the node's rotate property value (positive values for clockwise rotation).
Returns:
The cumulative rotation angle of this gesture

toString

public String toString()
Returns a string representation of this RotateEvent object.
Overrides:
toString in class GestureEvent
Returns:
a string representation of this RotateEvent object.

copyFor

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

copyFor

public RotateEvent copyFor(Object newSource, EventTarget newTarget, EventType<RotateEvent> type)
Creates 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

getEventType

public EventType<RotateEvent> 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 Event
Returns:
the event type

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 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