Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1003691 // registerFunctionKey - register function key (F1...F12) for a whole JFrame

JavaX fragment (include)

// key = 1 to 12
static void registerFunctionKey(JFrame frame, int key, O r) {
  S name = "F" + key;
  Action action = abstractAction(name, r);
  JComponent pnl = frame.getRootPane();
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1+key-1, 0);
  pnl.getActionMap().put(name, action);
  pnl.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name);
}

Author comment

Began life as a copy of #1003690

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: #1003691
Snippet name: registerFunctionKey - register function key (F1...F12) for a whole JFrame
Eternal ID of this version: #1003691/1
Text MD5: 6ce5365c3d4187a8a14c0eded7dea225
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-13 02:49:00
Source code size: 381 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 683 / 656
Referenced in: [show references]