0
我有兩個代表2個窗口的fxml文件:登錄窗口和應用程序窗口。點擊註冊後,出現第二個窗口。JavaFx:從fxml設置場景的根目錄忽略首選尺寸
我的問題是,第二個窗口與登錄窗口具有相同的大小。我的應用程序窗口的首選大小被忽略。
頂部app.fxml的:
<BorderPane fx:id="root" prefHeight="800.0" prefWidth="1000.0"
xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2"
fx:controller="...">
...
</BorderPane>
的代碼加載應用程序窗口:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/main/resources/fxml/app.fxml"));
mainWindowController = loader.getController();
scene.setRoot((Parent) loader.load());
所以我的問題是如何在場景加載app.fxml不忽略app.fxml的prefHeight和prefWidth?
感謝您的幫助。