MenuBarView

MenuBarView是一個提供繪製選單欄功能的基礎實現。MenuBarView繼承自BoxView

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

MenuBarViewMenuBarItem的例項構造。MenuBarItem本身接受MenuItem的例項。MenuItem可以定義其樣式和操作。MenuBarItem還可以定義一個用於啟用特定選單的熱鍵。

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))
);

預設繫結

預設的按鍵繫結

表1. 按鍵
命令 描述

游標左移

向左移動選擇

游標右移

向右移動選擇

預設的滑鼠繫結

表2. 滑鼠
命令 描述

釋放 | Button1

選擇項

事件

沒有任何事件。

© . This site is unofficial and not affiliated with VMware.