JavaFx - open window beside main windows

I am using JavaFx and want to open a new window next to the first window like in the picture. I can open a new window, but always on the first. How can i do this?

Windows next to each other.

   Parent detailsPanel = FXMLLoader.load(getClass().getResource("/fxml/DetailsPanel.fxml"));
    Stage stage = new Stage();

    stage.setTitle("Details");
    stage.setScene(new Scene(detailsPanel));
    stage.setResizable(false);
    stage.show();

      

+3


source to share


1 answer


Just do



double windowGap = 5 ;
Stage currentStage = ... ; // the current window...

stage.setX(currentStage.getX() + currentStage.getWidth() + windowGap);
stage.setY(currentStage.getY());

      

+3


source







All Articles