MenuBar
The MenuBar
allows you to insert a control element in the screen, which is always displayed at the top.
MenuTab tab1 = new MenuTab("File");
tab1.add(new MenuItem("New"));
tab1.add(new MenuItem("Save"));
tab1.add(new MenuItem("Open"));
tab1.add(new MenuItem("Exit").action(() -> {
Terminal.get().shutdown(1);
}));
MenuTab tab2 = new MenuTab("Options");
tab2.add(new MenuItem("Colors"));
tab2.add(new MenuItem("Font"));
tab2.add(new MenuItem("Language"));
MenuBarComponent menuBarComponent = new MenuBarComponent();
menuBarComponent.add(tab1);
menuBarComponent.add(tab2);

Methods
Method | Description |
---|---|
| Returns the width of menu block |
| Set maximum width of menu block |
| Sets selection style (Default: TextFont.UNDERLINE) |
| Add new tab |
| Remove tab |
| Returns selected tab. If none is present, null is returned |
| Selects a tab |
| Return all tabs |
Last modified: 01 Juni 2025