A MenuBar control traditionally is placed at the very top of the user
interface, and embedded within it are Menus
. To add a menu to
a menubar, you add it to the menus
ObservableList.
By default, for each menu added to the menubar, it will be
represented as a button with the Menu text
value displayed.
MenuBar sets focusTraversable to false.
To create and populate a MenuBar
, you may do what is shown below.
Please refer to the Menu
API page for more information on how to
configure it.
final Menu menu1 = new Menu("File");
final Menu menu2 = new Menu("Options");
final Menu menu3 = new Menu("Help");
MenuBar menuBar = new MenuBar();
menuBar.getMenus().addAll(menu1, menu2, menu3);
extends