1 | // key = 1 to 12 |
2 | static void registerShiftFunctionKey(JFrame frame, int key, final Runnable r) {
|
3 | S name = "Shift+F" + key; |
4 | Action action = abstractAction(name, r); |
5 | JComponent pnl = frame.getRootPane(); |
6 | KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1+key-1, InputEvent.SHIFT_MASK); |
7 | pnl.getActionMap().put(name, action); |
8 | pnl.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name); |
9 | } |
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: | 858 / 896 |
| Referenced in: | [show references] |