In my JavaFX application I need to detect when the user canceled a drag action (like right clicking
while dragging or pressing ESC
button while dragging). I tried to listen on every DragEvent
type on my main window
, like DRAG_EXITED_TARGET
or DRAG_EXITED
but those are fired even if the cursor moves to another Node
... I'm unable to narrow it to the single event of canceling the drag action.
I read that event.getGestureTarget() == null
could mean that the user canceled the action, but it's also null
when it leaves to another Node
.
2
votes