I\'ve been working on a software using JavaFX and I have a stupid but worrying problem.
In certain part of the code I have a HBox
, and, inside of it three
This is a most common alignment issue when you want to place an item towards the two corners of the Layout.
Let us say you want to have :
HBox
|
ImageView (Left)
Label (Center)
VBox (Right)
I very simple solution is to use two extra Regions
. One in between ImageView & Label. The other in between Label and VBox.
HBox
|
ImageView (Left)
Region
Label (Center)
Region
VBox (Right)
These Regions must have HGrow
set as Priority.Always
, so that if you resize the HBox, these two will grow, keeping the other elements intact in their location.
FXML example :
Please note the HBox.hgrow="ALWAYS"
in both the Regions.
Output