This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.1!

MenuBarView

MenuBarView is a base implementation providing functionality to draw a menu bar. MenuBarView inherits from BoxView.

┌─────────────────────────────┐
│ File Help                   │
└─────────────────────────────┘

MenuBarView is constructed with instances of MenuBarItem. MenuBarItem itself takes instances of MenuItem. MenuItem can define its style and action. MenuBarItem can also define a hot key which is used to active particular menu.

Runnable quitAction = () -> {
};
Runnable aboutAction = () -> {
};
MenuBarView menuBar = MenuBarView.of(
		MenuBarItem.of("File", MenuItem.of("Quit", MenuItemCheckStyle.NOCHECK, quitAction))
			.setHotKey(Key.f | KeyMask.AltMask),
		MenuBarItem.of("Help", MenuItem.of("About", MenuItemCheckStyle.NOCHECK, aboutAction)));

Default Bindings

Default key bindings are:

Table 1. Key
Command Description

CursorLeft

Move selection left

CursorRight

Move selection right

Default mouse bindings are:

Table 2. Mouse
Command Description

Released | Button1

Choose item

Events

Does not have any events.