Top Description Inners Fields Constructors Methods
javafx.scene.input

public final Class DragEvent

extends InputEvent
Class Inheritance
Imports
java.util.EnumSet, .Set, javafx.beans.NamedArg, javafx.event.EventTarget, .EventType, javafx.geometry.Point3D, com.sun.javafx.scene.input.InputEventUtils, java.io.IOException

Drag events replace mouse events during drag-and-drop gesture. The difference between press-drag-release and drag-and-drop gestures is described at MouseEvent.

Drag and drop gesture can be started by calling startDragAndDrop() (on a node or scene) inside of a DRAG_DETECTED event handler. The data to be transferred to drop target are placed to a dragBoard at this moment.

Drag entered/exited events behave similarly to mouse entered/exited events, please see MouseEvent overview.

Drag sources: initiating a drag and drop gesture

When a drag gesture is detected, an application can decide whether to start a drag and drop gesture or continue with a press-drag-release gesture.

The default drag detection mechanism uses mouse movements with a pressed button in combination with hysteresis. This behavior can be augmented by the application. Each MOUSE_PRESSED and MOUSE_DRAGGED event has a dragDetect flag that determines whether a drag gesture has been detected. The default value of this flag depends on the default detection mechanism and can be modified by calling setDragDetect() inside of an event handler. When processing of one of these events ends with the dragDetect flag set to true, a DRAG_DETECTED MouseEvent is sent to the potential gesture source (the object on which a mouse button has been pressed). This event notifies about the gesture detection.

Inside a DRAG_DETECTED event handler, if the startDragAndDrop() method is called on a node or scene and a dragged data is made available to the returned Dragboard, the object on which startDragAndDrop() has been called is considered a gesture source and the drag and drop gesture is started. The Dragboard has system clipboard functionality but is specifically used for drag and drop data transfer.

The startDragAndDrop() method takes a set of TransferModes supported by the gesture source. For instance passing only TransferMode.COPY indicates that the gesture source allows only copying of the data, not moving or referencing.

Following example shows a simple drag and drop source:

Rectangle rect = new Rectangle(100, 100);
rect.setOnDragDetected(new EventHandler<MouseEvent>() {
    @Override public void handle(MouseEvent event) {
        Dragboard db = startDragAndDrop(TransferMode.ANY);
        ClipboardContent content = new ClipboardContent();
        content.putString("Hello!");
        db.setContent(content);
        event.consume();
    }
});
 

Potential drop targets

After the drag and drop gesture has been started, any object (Node, Scene) over which the mouse is dragged is a potential drop target.

When the mouse is dragged into the boundaries of potential drop target, the potential target gets a DRAG_ENTERED event. When the mouse is dragged outside of the potential target's bounds, it gets a DRAG_EXITED event. There are also the bubbling DRAG_ENTERED_TARGET and DRAG_EXITED_TARGET variants. They behave similarly to mouse entered/exited events, please see MouseEvent overview.

A potential drop target can decide to change its appearance to let the user know that the dragged data can be dropped on it. This can be done in a DRAG_OVER event handler, based on the position of the mouse. Another option is to change the potential target's appearance in a DRAG_ENTERED and DRAG_EXITED handlers.

In DRAG_OVER event handler a potential drop target has the ability to make it known that it is an actual target. This is done by calling acceptTransferModes(TransferMode...) on the event, passing transfer modes it is willing to accept. If it is not called during the event delivery or if none of the passed transfer modes is supported by gesture source, then the potential drop target is not considered to be an actual drop target.

When deciding weather to accept the event by calling acceptTransferModes(TransferMode...), the type of data available on the Dragboard should be considered. Access to the Dragboard is provided by the getDragboard() method.

When accepting an event, the potential gesture target decides which TransferMode is accepted for the operation. To make the decision, DragBoard.getTransferModes() (set of transfer modes supported by the gesture source) and DragEvent.getTransferMode() (default transfer mode issued by platform, driven by key modifiers) can be used. It is possible to pass more transfer modes into the acceptTransferModes(TransferMode...) method. In this case it makes the decision in behalf of the application (it chooses the default mode if it's supported by gesture source and accepted by gesture target, otherwise it chooses the most common mode of the supported and accepted ones). The DRAG_DROPPED event's getTransferMode() later reports the transfer mode accepted by the DRAG_OVER event handler.

A drag and drop gesture ends when the mouse button is released. If this happens over a gesture target that accepted previous DRAG_OVER events with a transfer mode supported by gesture source, a DRAG_DROPPED event is sent to the gesture target. In its handler, the gesture target can access the data on the dragboard. After data has been transferred (or decided not to transfer), the gesture needs to be completed by calling setDropCompleted(Boolean) on the event. The Boolean argument indicates if the data has been transferred successfully or not. If it is not called, the gesture is considered unsuccessful.

Following example shows a simple drag and drop target for text data:

Rectangle rect = new Rectangle(100, 100);

rect.setOnDragOver(new EventHandler<DragEvent>() {
    @Override public void handle(DragEvent event) {
        Dragboard db = event.getDragboard();
        if (db.hasString()) {
            event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
        }
        event.consume();
    }
});

rect.setOnDragDropped(new EventHandler<DragEvent>() {
    @Override public void handle(DragEvent event) {
        Dragboard db = event.getDragboard();
        boolean success = false;
        if (db.hasString()) {
            System.out.println("Dropped: " + db.getString());
            success = true;
        }
        event.setDropCompleted(success);
        event.consume();
    }
});
 

Drag sources: finalizing drag and drop gesture

After the gesture has been finished, whether by successful or unsuccessful data transfer or being canceled, the DRAG_DONE event is sent to the gesture source. The getTransferMode() method of the event indicates to the gesture source how the transfer of data was completed. If the transfer mode has the value MOVE, then this allows the source to clear out its data. Clearing the source's data gives the appropriate appearance to a user that the data has been moved by the drag and drop gesture. If it has the value null, then the drag and drop gesture ended without any data being transferred. This could happen as a result of a mouse release event over a node that is not a drop target, or the user pressing the ESC key to cancel the drag and drop gesture, or by the gesture target reporting an unsuccessful data transfer.

Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DragEvent.State

These properties need to live in a separate object shared among all the copied events to make sure that the values are propagated to the original event.

Field Summary

Modifier and TypeField and Description
public static final EventType<DragEvent>
ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all drag event types.
public static final EventType<DragEvent>
DRAG_DONE

This event occurs on drag-and-drop gesture source after its data has been dropped on a drop target.

public static final EventType<DragEvent>
DRAG_DROPPED

This event occurs when the mouse button is released during drag and drop gesture on a drop target.

public static final EventType<DragEvent>
DRAG_ENTERED

This event occurs when drag gesture enters a node.

public static final EventType<DragEvent>
DRAG_ENTERED_TARGET

This event occurs when drag gesture enters a node.

public static final EventType<DragEvent>
DRAG_EXITED

This event occurs when drag gesture exits a node.

public static final EventType<DragEvent>
DRAG_EXITED_TARGET

This event occurs when drag gesture exits a node.

public static final EventType<DragEvent>
DRAG_OVER

This event occurs when drag gesture progresses within this node.

private transient Dragboard
private Object
private Object
private PickResult
pickResult

Information about the pick if the picked Node is a Shape3D node and its pickOnBounds is false.

private final double
sceneX

Horizontal x position of the event relative to the origin of the Scene that contains the DragEvent's node.

private final double
sceneY

Vertical y position of the event relative to the origin of the Scene that contains the DragEvent's node.

private final double
screenX

Absolute horizontal x position of the event.

private final double
screenY

Absolute vertical y position of the event.

private static final long
private final DragEvent.State
private TransferMode
private transient double
x

Horizontal x position of the event relative to the origin of the MouseEvent's node.

private transient double
y

Vertical y position of the event relative to the origin of the MouseEvent's node.

private transient double
z

Depth z position of the event relative to the origin of the MouseEvent's node.

Constructor Summary

AccessConstructor and Description
public
DragEvent(Object
the source of the event. Can be null.
source
,
EventTarget
the target of the event. Can be null.
target
,
EventType<DragEvent>
The type of the event.
eventType
,
Dragboard
the dragboard of the event.
dragboard
,
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
,
TransferMode
the transfer mode of the event.
transferMode
,
Object
the source of the DnD gesture of the event.
gestureSource
,
Object
the target of the DnD gesture of the event.
gestureTarget
,
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 DragEvent event.

public
DragEvent(EventType<DragEvent>
The type of the event.
eventType
,
Dragboard
the dragboard of the event.
dragboard
,
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
,
TransferMode
the transfer mode of the event.
transferMode
,
Object
the source of the DnD gesture of the event.
gestureSource
,
Object
the target of the DnD gesture of the event.
gestureTarget
,
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 DragEvent event with empty source and target.

Method Summary

Modifier and TypeMethod and Description
public void
acceptTransferModes(TransferMode...
the transfer mode for the drop operation.
transferModes
)

Accepts this DragEvent, choosing the transfer mode for the drop operation.

private static TransferMode

Returns:

The chosen transfer mode, null if none would work
chooseTransferMode
(Set<TransferMode>
Transfer modes supported by gesture source
supported
,
TransferMode[]
Transfer modes accepted by gesture
accepted
,
TransferMode
Transfer mode proposed by platform
proposed
)

Chooses a transfer mode for the operation

public DragEvent

Returns:

the event copy with the fields
copyFor
(Object
the new source of the copied event
source
,
EventTarget
the new target of the copied event
target
,
Object
the new gesture source.
gestureSource
,
Object
the new gesture target.
gestureTarget
,
EventType<DragEvent>
the new eventType
eventType
)

Creates a copy of the given drag event with the given fields substituted.

public DragEvent
copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.event.Event.copyFor.

Creates and returns a copy of this event with the specified event source and target.

public DragEvent

Returns:

the event copy with the fields
copyFor
(Object
source of the copied event
source
,
EventTarget
target of the copied event
target
,
EventType<DragEvent>
type of event
type
)

Creates a copy of the given drag event with the given fields substituted.

public final TransferMode

Returns:

transfer mode accepted by potential target
getAcceptedTransferMode
()

Gets transfer mode accepted by potential target.

public final Object

Returns:

the object that accepted the drag
getAcceptingObject
()

The object that accepted the drag.

public final Dragboard

Returns:

a dragboard that is available to transfer data
getDragboard
()

A dragboard that is available to transfer data.

public EventType<DragEvent>
getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Gets the event type of this event.

public final Object

Returns:

the source object of the drag and drop gesture
getGestureSource
()

The source object of the drag and drop gesture.

public final Object

Returns:

the target object of the drag and drop gesture
getGestureTarget
()

The target object of the drag and drop gesture.

public final PickResult

Returns:

new PickResult object that contains information about the pick
getPickResult
()

Returns information about the pick.

public final double

Returns:

horizontal position of the event relative to the origin of the Scene that contains the DragEvent's source
getSceneX
()

Returns horizontal position of the event relative to the origin of the Scene that contains the DragEvent's source.

public final double

Returns:

vertical position of the event relative to the origin of the Scene that contains the DragEvent's source
getSceneY
()

Returns vertical position of the event relative to the origin of the Scene that contains the DragEvent's source.

public final double

Returns:

absolute horizontal position of the event
getScreenX
()

Returns absolute horizontal position of the event.

public final double

Returns:

absolute vertical position of the event
getScreenY
()

Returns absolute vertical position of the event.

public final TransferMode

Returns:

the data transfer mode
getTransferMode
()

Data transfer mode.

public final double

Returns:

horizontal position of the event relative to the origin of the DragEvent's source
getX
()

Horizontal position of the event relative to the origin of the DragEvent's source.

public final double

Returns:

vertical position of the event relative to the origin of the DragEvent's source
getY
()

Vertical position of the event relative to the origin of the DragEvent's source.

public final double

Returns:

depth position of the event relative to the origin of the MouseEvent's source
getZ
()

Depth position of the event relative to the origin of the MouseEvent's source.

public final boolean

Returns:

is this event has been accepted
isAccepted
()

Indicates if this event has been accepted.

public boolean

Returns:

true if setDropCompleted(true) has been called
isDropCompleted
()

Whether setDropCompleted(true) has been called on this event.

private void
private void
recomputeCoordinatesToSource(DragEvent
Event whose coordinates are to be filled
newEvent
,
Object
Source object to compute coordinates for
newSource
)

Fills the given event by this event's coordinates recomputed to the given source object

public void
setDropCompleted(boolean
true indicates that the transfer was successful.
isTransferDone
)

Indicates that transfer handling of this DragEvent was completed successfully during a DRAG_DROPPED event handler.

Field Detail

ANYback to summary
public static final EventType<DragEvent> ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all drag event types.

DRAG_DONEback to summary
public static final EventType<DragEvent> DRAG_DONE

This event occurs on drag-and-drop gesture source after its data has been dropped on a drop target. The transferMode of the event shows what just happened at the drop target. If transferMode has the value MOVE, then the source can clear out its data. Clearing the source's data gives the appropriate appearance to a user that the data has been moved by the drag and drop gesture. A transferMode that has the value NONE indicates that no data was transferred during the drag and drop gesture.

DRAG_DROPPEDback to summary
public static final EventType<DragEvent> DRAG_DROPPED

This event occurs when the mouse button is released during drag and drop gesture on a drop target. Transfer of data from the DragEvent's dragboard should happen in handler of this event.

DRAG_ENTEREDback to summary
public static final EventType<DragEvent> DRAG_ENTERED

This event occurs when drag gesture enters a node. This event type is delivered only to the entered node, if parents want to filter it or get the bubbling event, they need to use DRAG_ENTERED_TARGET.

See Also
MouseEvent for more information about mouse entered/exited handling which is similar
DRAG_ENTERED_TARGETback to summary
public static final EventType<DragEvent> DRAG_ENTERED_TARGET

This event occurs when drag gesture enters a node. It's the bubbling variant, which is delivered also to all parents of the entered node (unless it was consumed). When notifications about entering some of node's children are not desired, DRAG_ENTERED event handler should be used.

See Also
MouseEvent for more information about mouse entered/exited handling which is similar
DRAG_EXITEDback to summary
public static final EventType<DragEvent> DRAG_EXITED

This event occurs when drag gesture exits a node. This event type is delivered only to the exited node, if parents want to filter it or get the bubbling event, they need to use DRAG_EXITED_TARGET.

See Also
MouseEvent for more information about mouse entered/exited handling which is similar
DRAG_EXITED_TARGETback to summary
public static final EventType<DragEvent> DRAG_EXITED_TARGET

This event occurs when drag gesture exits a node. It's the bubbling variant, which is delivered also to all parents of the exited node (unless it was consumed). When notifications about exiting some of node's children are not desired, DRAG_EXITED event handler should be used.

See Also
MouseEvent for more information about mouse entered/exited handling which is similar
DRAG_OVERback to summary
public static final EventType<DragEvent> DRAG_OVER

This event occurs when drag gesture progresses within this node.

dragboardback to summary
private transient Dragboard dragboard
gestureSourceback to summary
private Object gestureSource
Annotations
@SuppressWarnings:doclint:missing
gestureTargetback to summary
private Object gestureTarget
Annotations
@SuppressWarnings:doclint:missing
pickResultback to summary
private PickResult pickResult

Information about the pick if the picked Node is a Shape3D node and its pickOnBounds is false.

sceneXback to summary
private final double sceneX

Horizontal x position of the event relative to the origin of the Scene that contains the DragEvent's node. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the DragEvent's node.

sceneYback to summary
private final double sceneY

Vertical y position of the event relative to the origin of the Scene that contains the DragEvent's node. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the DragEvent's node.

screenXback to summary
private final double screenX

Absolute horizontal x position of the event.

screenYback to summary
private final double screenY

Absolute vertical y position of the event.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.scene.input.InputEvent.serialVersionUID.

stateback to summary
private final DragEvent.State state
Annotations
@SuppressWarnings:doclint:missing
transferModeback to summary
private TransferMode transferMode
Annotations
@SuppressWarnings:doclint:missing
xback to summary
private transient double x

Horizontal x position of the event relative to the origin of the MouseEvent's node.

yback to summary
private transient double y

Vertical y position of the event relative to the origin of the MouseEvent's node.

zback to summary
private transient double z

Depth z position of the event relative to the origin of the MouseEvent's node.

Constructor Detail

DragEventback to summary
public DragEvent(Object source, EventTarget target, EventType<DragEvent> eventType, Dragboard dragboard, double x, double y, double screenX, double screenY, TransferMode transferMode, Object gestureSource, Object gestureTarget, PickResult pickResult)

Constructs new DragEvent event. For DRAG_DROPPED and DRAG_DONE event types, the accepted state and acceptedTransferMode are set according to the passed transferMode.

Parameters
source:Object

the source of the event. Can be null.

target:EventTarget

the target of the event. Can be null.

eventType:EventType<DragEvent>

The type of the event.

dragboard:Dragboard

the dragboard of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

transferMode:TransferMode

the transfer mode of the event.

gestureSource:Object

the source of the DnD gesture of the event.

gestureTarget:Object

the target of the DnD gesture of the event.

pickResult: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
DragEventback to summary
public DragEvent(EventType<DragEvent> eventType, Dragboard dragboard, double x, double y, double screenX, double screenY, TransferMode transferMode, Object gestureSource, Object gestureTarget, PickResult pickResult)

Constructs new DragEvent event with empty source and target.

Parameters
eventType:EventType<DragEvent>

The type of the event.

dragboard:Dragboard

the dragboard of the event.

x:double

The x with respect to the scene.

y:double

The y with respect to the scene.

screenX:double

The x coordinate relative to screen.

screenY:double

The y coordinate relative to screen.

transferMode:TransferMode

the transfer mode of the event.

gestureSource:Object

the source of the DnD gesture of the event.

gestureTarget:Object

the target of the DnD gesture of the event.

pickResult: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 Detail

acceptTransferModesback to summary
public void acceptTransferModes(TransferMode... transferModes)

Accepts this DragEvent, choosing the transfer mode for the drop operation. Used to indicate that the potential drop target that receives this event is a drop target from DRAG_OVER event handler.

It accepts one of the transfer modes that are both passed into this method and supported by the gesture source. It accepts the default transfer mode if possible, otherwise the most common one of the acceptable modes.

Parameters
transferModes:TransferMode[]

the transfer mode for the drop operation.

chooseTransferModeback to summary
private static TransferMode chooseTransferMode(Set<TransferMode> supported, TransferMode[] accepted, TransferMode proposed)

Chooses a transfer mode for the operation

Parameters
supported:Set<TransferMode>

Transfer modes supported by gesture source

accepted:TransferMode[]

Transfer modes accepted by gesture

proposed:TransferMode

Transfer mode proposed by platform

Returns:TransferMode

The chosen transfer mode, null if none would work

copyForback to summary
public DragEvent copyFor(Object source, EventTarget target, Object gestureSource, Object gestureTarget, EventType<DragEvent> eventType)

Creates a copy of the given drag event with the given fields substituted.

Parameters
source:Object

the new source of the copied event

target:EventTarget

the new target of the copied event

gestureSource:Object

the new gesture source.

gestureTarget:Object

the new gesture target.

eventType:EventType<DragEvent>

the new eventType

Returns:DragEvent

the event copy with the fields

Since
JavaFX 8.0
copyForback to summary
public DragEvent copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.event.Event.copyFor.

Doc from javafx.event.Event.copyFor.

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.

Annotations
@Override
copyForback to summary
public DragEvent copyFor(Object source, EventTarget target, EventType<DragEvent> type)

Creates a copy of the given drag event with the given fields substituted.

Parameters
source:Object

source of the copied event

target:EventTarget

target of the copied event

type:EventType<DragEvent>

type of event

Returns:DragEvent

the event copy with the fields

Since
JavaFX 8.0
getAcceptedTransferModeback to summary
public final TransferMode getAcceptedTransferMode()

Gets transfer mode accepted by potential target.

Returns:TransferMode

transfer mode accepted by potential target

getAcceptingObjectback to summary
public final Object getAcceptingObject()

The object that accepted the drag.

Returns:Object

the object that accepted the drag

Since
JavaFX 8.0
getDragboardback to summary
public final Dragboard getDragboard()

A dragboard that is available to transfer data. Data can be placed onto this dragboard in handler of the DRAG_DETECTED mouse event. Data can be copied from this dragboard in handler of the DRAG_DROPPED event.

Returns:Dragboard

a dragboard that is available to transfer data

getEventTypeback to summary
public EventType<DragEvent> getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Doc from javafx.event.Event.getEventType.

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.

Annotations
@Override
getGestureSourceback to summary
public final Object getGestureSource()

The source object of the drag and drop gesture. Gesture source is the object that started drag and drop operation. The value null is valid in the case that the gesture comes from another application.

Returns:Object

the source object of the drag and drop gesture

getGestureTargetback to summary
public final Object getGestureTarget()

The target object of the drag and drop gesture. Gesture target is the object that accepts drag events. The value null is valid in the case that the drag and drop gesture has been canceled or completed without a transfer taking place or there is currently no event target accepting the drag events.

Returns:Object

the target object of the drag and drop gesture

getPickResultback to summary
public final PickResult getPickResult()

Returns information about the pick.

Returns:PickResult

new PickResult object that contains information about the pick

Since
JavaFX 8.0
getSceneXback to summary
public final double getSceneX()

Returns horizontal position of the event relative to the origin of the Scene that contains the DragEvent's source. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the DragEvent's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

horizontal position of the event relative to the origin of the Scene that contains the DragEvent's source

getSceneYback to summary
public final double getSceneY()

Returns vertical position of the event relative to the origin of the Scene that contains the DragEvent's source. If the node is not in a Scene, then the value is relative to the boundsInParent of the root-most parent of the DragEvent's node. Note that in 3D scene, this represents the flat coordinates after applying the projection transformations.

Returns:double

vertical position of the event relative to the origin of the Scene that contains the DragEvent's source

getScreenXback to summary
public final double getScreenX()

Returns absolute horizontal position of the event.

Returns:double

absolute horizontal position of the event

getScreenYback to summary
public final double getScreenY()

Returns absolute vertical position of the event.

Returns:double

absolute vertical position of the event

getTransferModeback to summary
public final TransferMode getTransferMode()

Data transfer mode. Before the data transfer is is performed, this is the default transfer mode set by system according to input events such as the user holding some modifiers. In time of data transfer (in DRAG_DROPPED event) it determines the transfer mode accepted by previous DRAG_OVER handler. After the data transfer (in DRAG_DONE event) it determines the actual mode of the transfer done.

Returns:TransferMode

the data transfer mode

getXback to summary
public final double getX()

Horizontal position of the event relative to the origin of the DragEvent's source.

Returns:double

horizontal position of the event relative to the origin of the DragEvent's source

getYback to summary
public final double getY()

Vertical position of the event relative to the origin of the DragEvent's source.

Returns:double

vertical position of the event relative to the origin of the DragEvent's source

getZback to summary
public final double getZ()

Depth position of the event relative to the origin of the MouseEvent's source.

Returns:double

depth position of the event relative to the origin of the MouseEvent's source

Since
JavaFX 8.0
isAcceptedback to summary
public final boolean isAccepted()

Indicates if this event has been accepted.

Returns:boolean

is this event has been accepted

Default Value
false
See Also
acceptTransferModes
isDropCompletedback to summary
public boolean isDropCompleted()

Whether setDropCompleted(true) has been called on this event.

Returns:boolean

true if setDropCompleted(true) has been called

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides javafx.event.Event.readObject.

Annotations
@SuppressWarnings:doclint:missing
recomputeCoordinatesToSourceback to summary
private void recomputeCoordinatesToSource(DragEvent newEvent, Object newSource)

Fills the given event by this event's coordinates recomputed to the given source object

Parameters
newEvent:DragEvent

Event whose coordinates are to be filled

newSource:Object

Source object to compute coordinates for

setDropCompletedback to summary
public void setDropCompleted(boolean isTransferDone)

Indicates that transfer handling of this DragEvent was completed successfully during a DRAG_DROPPED event handler. No dragboard access can happen after this call.

Parameters
isTransferDone:boolean

true indicates that the transfer was successful.

Exceptions
IllegalStateException:
if this is not a DRAG_DROPPED event
javafx.scene.input back to summary

private Class DragEvent.State

extends Object
Class Inheritance

These properties need to live in a separate object shared among all the copied events to make sure that the values are propagated to the original event.

Field Summary

Modifier and TypeField and Description
pack-priv boolean
accepted

Whether this event has been accepted.

pack-priv TransferMode
acceptedTransferMode

Transfer mode accepted by the potential gesture target.

pack-priv Object
acceptingObject

Object that accepted this event.

pack-priv boolean
dropCompleted

Whether drop completed successfully.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

acceptedback to summary
pack-priv boolean accepted

Whether this event has been accepted.

acceptedTransferModeback to summary
pack-priv TransferMode acceptedTransferMode

Transfer mode accepted by the potential gesture target.

acceptingObjectback to summary
pack-priv Object acceptingObject

Object that accepted this event.

dropCompletedback to summary
pack-priv boolean dropCompleted

Whether drop completed successfully.

Constructor Detail

Stateback to summary
private State()