I wanna it will be okay when the number variables is changed, but when the are increased the button goes out from the window. How to fix it? Also how to put the bar down to the level of "10$", so they will be in the same row?
Here is my code :
VBox vboxBottom = new VBox();
HBox hboxBottomElements = new HBox(15);
HBox hboxBottomMain = new HBox(0);
Region region = new Region();
region.setPrefWidth(500);
hboxBottomElements.getChildren().addAll(visaLabel, separator2, adLabel, separator3, governRelationStatus, separator4, region, next);
hboxBottomElements.setPadding(new Insets(5));
vboxBottom.getChildren().addAll(separator1, new Group(hboxBottomElements));
vboxBottom.setPadding(new Insets(3));
hboxBottomMain.getChildren().addAll(new Group(moneyBox), vboxBottom);
hboxBottomMain.setPadding(new Insets(3));
layout.setBottom(hboxBottomMain);
By using a
Group
hereyou're creating a layout structure that resizes
hboxBottomElements
to it's prefered size independent of the space available.HBox
simply moves elements out the right side of it's bounds, if the space available does not suffice. This means if theGroup
containingmoneyBox
grows, theButton
is moved out of theHBox
...The following simpler example demonstrates the behavior:
This will resize
filler
to make theHBox
fit the window.Now replace
with
and the
Button
will be moved out of the window...