GoXR3Plus GoXR3Plus - 10 months ago 106
Java Question

JavaFX Add Node to ScrollPane with SceneBuilder

The problem

In code it works perfectly if i do it like:

TilePane tilePane = new TilePane();
ScrollPane scrollPane = new ScrollPane(tilePane);

I mean that every time the
has more items that can be shown then a
without adding any extra code or setting minimum or preferred size of

Using SceneBuilder

Instead of using pure code i want to have the same result as the above using SceneBuilder but every time i am trying to do it something like this: happensenter image description here

I have to set the preffered size to the
.Why thought? And it doesn't work as expected.I want it to automatically work as described in the first lines of the question.A good description is needed...

Answer Source

See the prefWidth and prefHeight to USE_COMPUTED_SIZE. These are the default values for a TilePane, but SceneBuilder seems to set them to default numeric values when you drop the TilePane into a ScrollPane.

You can select these values directly by clicking on the drop-down boxes next to the text field for the prefWidth and prefHeight text fields.