JavaFx - 在 main windows 旁边打开 window

JavaFx - Open window next to main windows

我正在使用 JavaFx,我想在第一个 window 旁边打开一个新的 window,如图中所示。我可以打开一个新的 window,但它总是在第一个。我该怎么做?

   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();

随心所欲

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

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