// keyCode = KeyEvent VK_... static void registerKey(JComponent c, int keyCode, S name, final O r) { Action action = abstractAction(name, r); KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, 0); c.getActionMap().put(name, action); c.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name); } static void registerKey(JFrame frame, int keyCode, S name, final O r) { registerKey(frame.getRootPane(), keyCode, name, r); }
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: | #1004136 |
Snippet name: | registerKey - Note: always registers a key for a whole JFrame! |
Eternal ID of this version: | #1004136/1 |
Text MD5: | 071d90845964e016d01e4336d9da2c11 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-01-31 06:44:22 |
Source code size: | 457 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 648 / 612 |
Referenced in: | #1005373 - registerCtrlKey - Note: always registers a key for a whole JFrame! #1006654 - Standard functions list 2 (LIVE, continuation of #761) |