// key = 1 to 12 static void registerCtrlFunctionKey(JFrame frame, int key, final Runnable r) { S name = "Ctrl+F" + key; Action action = abstractAction(name, r); JComponent pnl = frame.getRootPane(); KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1+key-1, InputEvent.CTRL_MASK); pnl.getActionMap().put(name, action); pnl.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name); }
Began life as a copy of #1003927
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: | #1004191 |
Snippet name: | registerCtrlFunctionKey - register Ctrl + function key (F1...F12) for a whole JFrame |
Eternal ID of this version: | #1004191/1 |
Text MD5: | e2f11c4180bb77eab1aae048408acd09 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-09 17:46:29 |
Source code size: | 422 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 541 / 555 |
Referenced in: | [show references] |