Menus in JavaFX start with a component called MenuBar. We want this menu to be at the top of the window, of course, so we add the component to the top section of our BorderPane. If you use Scene Builder, you will end up with something like this in your FXML file:
<MenuBar BorderPane.alignment="CENTER"> <menus> <Menu mnemonicParsing="false" text="File"> <items> <MenuItem mnemonicParsing="false" text="Close" /> </items> </Menu> <Menu mnemonicParsing="false" text="Edit"> <items> <MenuItem mnemonicParsing="false" text="Delete" /> </items> </Menu> <Menu mnemonicParsing="false" text="Help"> <items> <MenuItem mnemonicParsing="false" text="About" /> </items> </Menu> </menus> </MenuBar>
We won't be needing the edit menu, so we can remove ...