I\'ve been trying to move an undecorated stage around the screen, by using the following mouse listeners:
I'm using this solution for dragging undecoraqted stages by dragging any contained node.
private void addDraggableNode(final Node node) {
node.setOnMousePressed(new EventHandler() {
@Override
public void handle(MouseEvent me) {
if (me.getButton() != MouseButton.MIDDLE) {
initialX = me.getSceneX();
initialY = me.getSceneY();
}
}
});
node.setOnMouseDragged(new EventHandler() {
@Override
public void handle(MouseEvent me) {
if (me.getButton() != MouseButton.MIDDLE) {
node.getScene().getWindow().setX(me.getScreenX() - initialX);
node.getScene().getWindow().setY(me.getScreenY() - initialY);
}
}
});
}