📄 e863. adding an inputmap to a component.txt
字号:
InputMap inputMap = new InputMap();
// Add a KeyStroke
inputMap.put(KeyStroke.getKeyStroke("F2"), "actionName");
inputMap.setParent(component.getInputMap(JComponent.WHEN_FOCUSED));
component.setInputMap(JComponent.WHEN_FOCUSED, inputMap);
Related Examples
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -