📄 e1005. listing the key bindings in a jtextcomponent keymap.txt
字号:
A text component has an additional list of key bindings that is searched after its inputmaps. This additional list is called a keymap. The inputmap mechanism is newer but keymaps were left in place for backwards compatibility.
JTextArea component = new JTextArea();
Keymap map = component.getKeymap();
while (map != null) {
KeyStroke[] keys = map.getBoundKeyStrokes();
for (int i=0; i<keys.length; i++) {
// This method is defined in e859 Converting a KeyStroke to a String
String keystrokeStr = keyStroke2String(keys[i]);
// Get the action name bound to this keystroke
Action action = (Action)map.getAction(keys[i]);
}
// The default action is invoked if a character is typed
// and no key binding exists in the component's InputMap or Keymap.
Action defAction = map.getDefaultAction();
// Process all parent keymaps as well
map = map.getResolveParent();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -