【问题标题】:JavaFx - Open window next to main windowsJavaFx - 在主窗口旁边打开窗口
【发布时间】:2015-07-15 17:16:22
【问题描述】:

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

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

【问题讨论】:

  • 'on the main' 是什么意思?

标签: java javafx java-8


【解决方案1】:

做事

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

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

【讨论】:

    猜你喜欢
    • 2013-02-09
    • 1970-01-01
    • 2011-04-24
    • 1970-01-01
    • 2017-08-26
    • 1970-01-01
    • 1970-01-01
    • 2015-07-16
    • 1970-01-01
    相关资源
    最近更新 更多