📄 e814. creating a menu item that listens for changes to its selection status.txt
字号:
A menu item can receive notification of selection changes by overriding its menuSelectionChanged() method. See also e808 Creating a JMenuBar, JMenu, and JMenuItem Component.
JMenuItem item = new JMenuItem("Label") {
// This method is called whenever the selection status of
// this menu item is changed
public void menuSelectionChanged(boolean isSelected) {
// Always forward the event
super.menuSelectionChanged(isSelected);
if (isSelected) {
// The menu item is selected
} else {
// The menu item is no longer selected
}
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -