// key = 1 to 12
static void registerShiftFunctionKey(JFrame frame, int key, final Runnable r) {
S name = "Shift+F" + key;
Action action = abstractAction(name, r);
JComponent pnl = frame.getRootPane();
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1+key-1, InputEvent.SHIFT_MASK);
pnl.getActionMap().put(name, action);
pnl.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name);
}Began life as a copy of #1003691
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1003927 |
| Snippet name: | registerShiftFunctionKey - register Shift + function key (F1...F12) for a whole JFrame |
| Eternal ID of this version: | #1003927/1 |
| Text MD5: | 09c2b182e6efa100e9c4b809dfbee160 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-07-30 19:18:57 |
| Source code size: | 425 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1081 / 1102 |
| Referenced in: | #1004191 - registerCtrlFunctionKey - register Ctrl + function key (F1...F12) for a whole JFrame #1006654 - Standard functions list 2 (LIVE, continuation of #761) |