Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FXML minHeight & minWidth attributs ignored?

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>
like image 303
Jeankowkow Avatar asked May 02 '16 11:05

Jeankowkow


People also ask

What is the FXML file for?

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.

What is FXML code?

FXML is an XML-based language that provides the structure for building a user interface separate from the application logic of your code.

Do I need to use FXML?

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.


1 Answers

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);
...
like image 155
7twenty7 Avatar answered Sep 22 '22 00:09

7twenty7