Is it possible to have multiple Buttons
set to Bottom
(left, center, right)?
This is what I tried:
private Pane createPane() {
BorderPane rootPane = new BorderPane();
rootPane.setTop(createMenueBar());
rootPane.setCenter(createTableView(model.getIssues()));
rootPane.setBottom(createDeleteIssueButton());
rootPane.setBottom(createCloseIssueButton());
rootPane.setBottom(createCreateNewIssueButton());
BorderPane.setAlignment(deleteIssueButton, Pos.BOTTOM_LEFT);
BorderPane.setAlignment(closeIssueButton, Pos.BOTTOM_CENTER);
BorderPane.setAlignment(createIssueButton, Pos.BOTTOM_RIGHT);
return rootPane;
}
Result:
As you can see it only shows the last added Button
. What is the best way to get this done with JavaFX/BorderPane? I'm very new to this so let me know if you need any more info!
Nested layouts
Gather the multiple buttons into a layout manager. Place that layout manager object in the bottom position of your
BorderPane
.For example, you might choose
FlowPane
as your layout manager.The
BorderPane
places only a single widget in the bottom slot. You want your container of buttons to be that widget.Your use of
Pos.BOTTOM_LEFT
and such determines where the widget is placed within the bottom slot. TheBOTTOM
inBOTTOM_LEFT
means bottom slot of the given space within a slot, not the bottom of theBorderPane
. Two different bottoms involved here.