This version is still in development and is not considered stable yet. 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:
Command | Description |
---|---|
CursorLeft |
Move selection left |
CursorRight |
Move selection right |
Default mouse bindigs are:
Command | Description |
---|---|
Released | Button1 |
Choose item |