一、节点原拖拽事件
//鼠标拖拽进入node
node.setOnMouseDragEntered(event->{//do something
});//鼠标拖拽退出node
node.setOnMouseDragExited(event->{//do something
});//鼠标拖拽经过node(入-出)
node.setOnMouseDragOver(event->{//do something
});//鼠标拖拽释放
node.setOnMouseDragReleased(event->{//do something
});//鼠标拖拽持续
node.setOnMouseDragged(event->{//do something
});//鼠标拖拽侦听
node.setOnMouseDragDetected(event->{//do something
});
二、节点监听拖拽事件
//鼠标拖拽进入
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_ENTERED,event->{//do something
});//鼠标拖拽进入(子节点进入事件冒泡)
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_ENTERED_TARGET,event->{//do something
});//鼠标拖拽退出
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_EXITED,event->{//do something
});//鼠标拖拽退出(子节点退出事件冒泡)
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_EXITED_TARGET,event->{//do something
});//鼠标拖拽经过
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_OVER,event->{//do something
});//鼠标拖拽释放
node.addEventFilter(MouseDragEvent.MOUSE_DRAG_RELEASED,event->{//do something
});//鼠标拖拽持续
node.addEventFilter(MouseDragEvent.MOUSE_DRAGGED, event -> {//do something});//鼠标拖拽侦听
node.addEventFilter(MouseDragEvent.DRAG_DETECTED, event -> {//do something});