I\'ve been trying to move an undecorated stage around the screen, by using the following mouse listeners:
Based on jewelsea's reply i made two lamba expressions to set the MouseListeners directly on the scene in my start() method. Works fine :)
private double xOffset;
private double yOffset;
/*
The two following lambda expressions makes it possible to move the application without the standard StageStyle
*/
//Lambda mouse event handler
scene.setOnMousePressed(event -> {
xOffset = primaryStage.getX() - event.getScreenX();
yOffset = primaryStage.getY() - event.getScreenY();
});
//Lambda mouse event handler
scene.setOnMouseDragged(event -> {
primaryStage.setX(event.getScreenX() + xOffset);
primaryStage.setY(event.getScreenY() + yOffset);
});enter code here