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

这是我的FXML根 Pane :

<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>

最佳答案

为此,您必须设置minHeightminWidthStage

在您的Java代码中的某处...:

例子:

...
yourStage.setMinHeight(480);
yourStage.setMinWidth(640);
...

关于java - FXML的minHeight和minWidth属性被忽略了吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36981599/

10-11 04:41