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

8
LINES

< > BotCompany Repo | #1006688 // registerRightKey - register cursor-left key for a whole JFrame

JavaX fragment (include)

1  
static void registerRightKey(JFrame frame, O r) {
2  
  S name = "Right";
3  
  Action action = abstractAction(name, r);
4  
  JComponent pnl = frame.getRootPane();
5  
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
6  
  pnl.getActionMap().put(name, action);
7  
  pnl.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name);
8  
}

Author comment

Began life as a copy of #1006687

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006688
Snippet name: registerRightKey - register cursor-left key for a whole JFrame
Eternal ID of this version: #1006688/1
Text MD5: 1eddf1fe5f842e6e1d47ff3bd4040920
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:14:09
Source code size: 346 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 490
Referenced in: [show references]