List of usage examples for javafx.scene Node setOnMouseDragged
public final void setOnMouseDragged(EventHandler<? super MouseEvent> value)
From source file:Main.java
public static void addDraggableNode(final Node node) { node.setOnMousePressed((MouseEvent me) -> { dragInitialX = me.getSceneX();/*from www . j a va 2 s .c om*/ dragInitialY = me.getSceneY(); }); node.setOnMouseDragged((MouseEvent me) -> { node.getScene().getWindow().setX(me.getScreenX() - dragInitialX); node.getScene().getWindow().setY(me.getScreenY() - dragInitialY); }); }