I new to javaFx and using fxml to create templates.
I can't manage to center a Vbox
in a Pane
that is too big, although I'm certain it must be quite straightforward.
I also want a border around the VBox
.
Can anyone help? Here is what I have:
<TitledPane text="Title" collapsible="false">
<content>
<GridPane hgap="10" vgap="10">
<children>
<VBox alignment="TOP_CENTER" spacing="10">
<!-- Content -->
</VBox>
</children>
<columnConstraints>
<ColumnConstraints halignment="CENTER"/>
</columnConstraints>
<rowConstraints>
<RowConstraints/>
</rowConstraints>
</GridPane>
</content>
</TitledPane>
I guess the GridPane
is a bad idea, but this is the way I know to have the borders as I want them.
Thanks for your time!
Yes it is. Using a
GridPane
for a single child is a overkill. Simply use aStackPane
with apadding
of10
: