e1005. listing the key bindings in a jtextcomponent keymap.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 23 行
TXT
23 行
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 + =
减小字号Ctrl + -
显示快捷键?