public final class MouseDragEvent extends MouseEvent
MouseEvent
.
Full press-drag-release gesture can be started by calling
startFullDrag()
(on a node or scene) inside of a DRAG_DETECTED
event handler. This call activates delivering of MouseDragEvent
s
to the nodes that are under cursor during the dragging gesture.
When you drag a node, it's still under cursor, so it is considered
being a potential gesture target during the whole gesture. If you need to
drag a node to a different node and let the other node know about it,
you need to ensure that the nodes under the dragged node are picked
as the potential gesture targets. You can achieve this by calling
setMouseTransparent(true)
on the dragged node in a
MOUSE_PRESSED
handler and returning it back to false in a
MOUSE_RELEASED
handler. This way the nodes under the dragged
node will receive the MouseDragEvent
s, while all the
MouseEvent
s will still be delivered to the (currently mouse
transparent) gesture source.
The entered/exited events behave similarly to mouse entered/exited
events, please see MouseEvent
overview.
Modifier and Type | Field and Description |
---|---|
static EventType<MouseDragEvent> |
ANY
Common supertype for all mouse event types.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_ENTERED
This event occurs when the gesture enters a node.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_ENTERED_TARGET
This event occurs when the gesture enters a node.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_EXITED
This event occurs when the gesture exits a node.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_EXITED_TARGET
This event occurs when the gesture exits a node.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_OVER
This event occurs when the gesture progresses within this node.
|
static EventType<MouseDragEvent> |
MOUSE_DRAG_RELEASED
This event occurs when the gesture ends (by releasing mouse button)
on this node.
|
DRAG_DETECTED, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_ENTERED_TARGET, MOUSE_EXITED, MOUSE_EXITED_TARGET, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED
consumed, eventType, NULL_SOURCE_TARGET, target
source
Constructor and Description |
---|
MouseDragEvent(EventType<MouseDragEvent> eventType,
double x,
double y,
double screenX,
double screenY,
MouseButton button,
int clickCount,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean primaryButtonDown,
boolean middleButtonDown,
boolean secondaryButtonDown,
boolean synthesized,
boolean popupTrigger,
PickResult pickResult,
Object gestureSource)
Constructs new MouseDragEvent event with null source and target.
|
MouseDragEvent(Object source,
EventTarget target,
EventType<MouseDragEvent> eventType,
double x,
double y,
double screenX,
double screenY,
MouseButton button,
int clickCount,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean primaryButtonDown,
boolean middleButtonDown,
boolean secondaryButtonDown,
boolean synthesized,
boolean popupTrigger,
PickResult pickResult,
Object gestureSource)
Constructs new MouseDragEvent event.
|
Modifier and Type | Method and Description |
---|---|
MouseDragEvent |
copyFor(Object newSource,
EventTarget newTarget)
Copies this event for a different source and target.
|
MouseDragEvent |
copyFor(Object newSource,
EventTarget newTarget,
EventType<? extends MouseEvent> type)
Creates a copy of the given event with the given fields substituted.
|
EventType<MouseDragEvent> |
getEventType()
Gets the event type of this event.
|
Object |
getGestureSource()
Returns the source object of the ongoing gesture.
|
String |
toString()
Returns a string representation of this
MouseDragEvent object. |
copyForMouseDragEvent, getButton, getClickCount, getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDragDetect, isMetaDown, isMiddleButtonDown, isPopupTrigger, isPrimaryButtonDown, isSecondaryButtonDown, isShiftDown, isShortcutDown, isStillSincePress, isSynthesized, setDragDetect
getSource
public static final EventType<MouseDragEvent> ANY
public static final EventType<MouseDragEvent> MOUSE_DRAG_OVER
public static final EventType<MouseDragEvent> MOUSE_DRAG_RELEASED
public static final EventType<MouseDragEvent> MOUSE_DRAG_ENTERED_TARGET
MOUSE_DRAG_ENTERED
event handler should
be used.public static final EventType<MouseDragEvent> MOUSE_DRAG_ENTERED
MOUSE_DRAG_ENTERED_TARGET
.public static final EventType<MouseDragEvent> MOUSE_DRAG_EXITED_TARGET
MOUSE_DRAG_EXITED
event handler should
be used.public static final EventType<MouseDragEvent> MOUSE_DRAG_EXITED
MOUSE_DRAG_EXITED_TARGET
.public MouseDragEvent(Object source, EventTarget target, EventType<MouseDragEvent> eventType, double x, double y, double screenX, double screenY, MouseButton button, int clickCount, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean primaryButtonDown, boolean middleButtonDown, boolean secondaryButtonDown, boolean synthesized, boolean popupTrigger, PickResult pickResult, Object gestureSource)
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.button
- the mouse button usedclickCount
- number of click countsshiftDown
- 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.primaryButtonDown
- true if primary button was pressed.middleButtonDown
- true if middle button was pressed.secondaryButtonDown
- true if secondary button was pressed.synthesized
- if this event was synthesizedpopupTrigger
- whether this event denotes a popup trigger for current platformpickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinates and targetgestureSource
- source object of the ongoing gesture.public MouseDragEvent(EventType<MouseDragEvent> eventType, double x, double y, double screenX, double screenY, MouseButton button, int clickCount, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean primaryButtonDown, boolean middleButtonDown, boolean secondaryButtonDown, boolean synthesized, boolean popupTrigger, PickResult pickResult, Object gestureSource)
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.button
- the mouse button usedclickCount
- number of click countsshiftDown
- 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.primaryButtonDown
- true if primary button was pressed.middleButtonDown
- true if middle button was pressed.secondaryButtonDown
- true if secondary button was pressed.synthesized
- if this event was synthesizedpopupTrigger
- whether this event denotes a popup trigger for current platformpickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinatesgestureSource
- source object of the ongoing gesture.public Object getGestureSource()
startFullDrag
method being called on it).public String toString()
MouseDragEvent
object.toString
in class MouseEvent
MouseDragEvent
object.public MouseDragEvent copyFor(Object newSource, EventTarget newTarget)
MouseEvent
copyFor
in class MouseEvent
newSource
- New event sourcenewTarget
- New event targetpublic MouseDragEvent copyFor(Object newSource, EventTarget newTarget, EventType<? extends MouseEvent> type)
MouseEvent
copyFor
in class MouseEvent
type
- the new eventTypepublic EventType<MouseDragEvent> getEventType()
Event
Event
class can have different event types. These event types further specify
what kind of event occurred.getEventType
in class MouseEvent
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.