In Java Swing
it is possible to put a menu on the right side of the menu bar using:
menubar.add(menu1);
menubar.add(Box.createHorizontalGlue());
menubar.add(menu2);
This will put menu1
on the left and menu2
on the right. This function is (obviously) not available in JavaFX
.
In JavaFX
, I have seen that the same can be achieved for a toolbar using:
final Pane rightSpacer = new Pane();
HBox.setHgrow(
rightSpacer,
Priority.SOMETIMES
);
Although, this workaround is not usuable for menus.
Question: is there a way to create a right spacer for menus in JavaFX
?