How can I set a minimum size to my window ? I try to set the minHeight
minWidth
value but I can still resize the Window under this values with the mouse.
Here is my FXML root 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>
FXML is an XML-based user interface markup language created by Oracle Corporation for defining the user interface of a JavaFX application. FXML presents an alternative to designing user interfaces using procedural code, and allows for abstracting program design from program logic.
FXML is an XML-based language that provides the structure for building a user interface separate from the application logic of your code.
You can not write a single FXML file but instead would have to write many single files, each would build a small part of the custom component. This is not really handy to manage, so most developers choose to do it without FXML, directly in code.
To do so you have to set the minHeight
and minWidth
of your Stage
.
Somewhere in your java code...:
Example:
...
yourStage.setMinHeight(480);
yourStage.setMinWidth(640);
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With