Javafx FXML prefHeight和prefWidth与场景的高度和宽度

Javafx FXML prefHeight和prefWidth与场景的高度和宽度,javafx,fxml,Javafx,Fxml,在我的fxml文件中,根元素如下所示: <SplitPane dividerPositions="0.5" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fx

在我的
fxml
文件中,根元素如下所示:

<SplitPane dividerPositions="0.5" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.AbweichungenKonfigurationController">
   ...
</SplitPane>
被场景大小覆盖:

primaryStage.setScene(new Scene(root, 1000, 800));
出现的窗口具有场景构造函数中定义的大小


是否有机会使用fxml文件中定义的大小?或者我应该如何处理此问题?

无论其最小/预/最大大小,
场景
将强制其根采用
场景
的大小

尝试将
拆分窗格
包装在
堆栈窗格
中,在
堆栈窗格
上没有大小限制。
StackPane
将遵循
SplitPane
的首选大小:

<StackPane xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.AbweichungenKonfigurationController">

    <SplitPane dividerPositions="0.5" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" >
       ...
    </SplitPane>

</StackPane>

...
<StackPane xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.AbweichungenKonfigurationController">

    <SplitPane dividerPositions="0.5" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" >
       ...
    </SplitPane>

</StackPane>