I created a FXML file using JavaFX Scene Builder 1.1. An AnchorPane is created by default. Why can't I modify the resizable attribute?
3 Answers
Do you want to disable window resizing? If so, you can do that in your application program:
stage.setResizable(false);
Why you can't edit bounds
Checkout the javadoc on layoutBounds and boundsInLocal. You will notice that both are ReadOnlyObjectProperties, which is why you can't directly modify them in SceneBuilder.
How to resize a node in SceneBuilder
You can indirectly effect the bounds properties and directly set the resizable properties of the node by altering the min, pref and max height and width.
You can also set the pref size by selecting the pane to be resized and dragging the resizing anchors the surround the selected pane.
Further Information
You might want to read the Oracle tutorial on Tips for Sizing Nodes and Amy Fowler's presentation on JavaFX layout.
-
I think Scene Builder could do a better job in indicating that it's a read-only property and cannot be set otherwise. Maybe they should just conceal the field, or put a hint bubble on there saying "This can only be modified via code, not here." Or better yet, allow the designer to uncheck the box and place the
stage.setResizable(false);
in thestart()
method. Commented Jul 17, 2019 at 1:40