FXML minHeight和minWidth属性被忽略了吗?

Jea*_*kow 6 java javafx minimum-size window-resize fxml

如何设置窗口的最小尺寸?我尝试设置minHeight minWidth值,但我仍然可以使用鼠标在此值下调整窗口大小.

这是我的FXML根窗格:

<BorderPane fx:id="borderPane"
        minHeight="200" minWidth="400" prefHeight="600" prefWidth="800"
        xmlns="http://javafx.com/javafx/null"
        xmlns:fx="http://javafx.com/fxml/1"
        fx:controller="simulation.Simulation_Controller">
</BorderPane>
Run Code Online (Sandbox Code Playgroud)

7tw*_*ty7 4

为此,您必须设置您的minHeight和。minWidthStage

在你的java代码中的某个地方...:

例子:

...
yourStage.setMinHeight(480);
yourStage.setMinWidth(640);
...
Run Code Online (Sandbox Code Playgroud)