For the latest stable version, please use Spring Shell 3.4.0!

MenuBarView

MenuBarView is a base implementation providing functionality to draw a menu bar. Inherits 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 bindigs are:

Table 1. Key
Command Description

CursorLeft

Move selection left

CursorRight

Move selection right

Default mouse bindigs are:

Table 2. Mouse
Command Description

Released | Button1

Choose item

Events

Does not have any events.