Step 1
Go to your Main class of your project and set your stage to be UNDERDECORATED or TRANSPARENT.
stage.initStyle(StageStyle.UNDECORATED);
Step 2
The next thing you want to do is initialize two doubles for the x and y screen offsets;
private double xOffset = 0;
private double yOffset = 0;
Step 3
Add mouse events to your root, i.e your FXML loader and you are ready to “move”
// Parent root = FXMLLoader.load(getClass().getResource("login.fxml"));
root.setOnMousePressed(event -> {
xOffSet = event.getSceneX();
yOffSet = event.getSceneY();
});
root.setOnMouseDragged(event -> {
stage.setX(event.getScreenX() - xOffSet);
stage.setY(event.getScreenY() - yOffSet);
});