Application Menus

In NautDrafter the menu is located at the top left of the screen in the Title bar (except login screen). Menus are split into two types: Application wide and screen specific menus.

Application wide menus

These menus will appear in every screen. The menu is a JavaFX MenuButton located in the TitleBar class of the controller package. This is the class you will need to change to edit the menus.

To add a new menu option you will need to edit the getGlobalMenuItems() method by creating a new instance of a JavaFX MenuItem and add this into the creation of the globalMenus array.

Make sure you add them before the SeparatorMenuItem that splits the preferences and help options from the other options as those two options are used for the login screen also.

Preferences sub menu

The preference sub menu is built in the prefs() method. These options are needed in the login screen and have to be rebuilt as having two instances of a sub menu in different places causes JavaFX to have errors.

These options are generally used to save preferences about how NautDrafter runs. They use the Java Preferences class to store and retrieve data. NautDrafter has an application wide  preferences object obtainable by calling NautDrafter.getPreferences().

Screen specific menus

These menus will only appear in the specific screens they are designated to.

The SubScreen interface defines the onShow and onHide methods which return an array of JavaFX MenuItem. These will be used to add and remove the menu options from the Application wide menu in the title bar.

Make sure that the MenuItem array that is returned from onHide is the same array that is returned from onShow. This will make sure that the menu options will be removed as Object equality is used to remove the items from the menu.