List of usage examples for javafx.scene Node setOnMousePressed
public final void setOnMousePressed(EventHandler<? super MouseEvent> value)
From source file:Main.java
public static void addDraggableNode(final Node node) { node.setOnMousePressed((MouseEvent me) -> { dragInitialX = me.getSceneX();/*from w w w . j a v a 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); }); }