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

8
LINES

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

JavaX fragment (include)

1  
static void registerLeftKey(JFrame frame, O r) {
2  
  S name = "Left";
3  
  Action action = abstractAction(name, r);
4  
  JComponent pnl = frame.getRootPane();
5  
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 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 #1003691

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: #1006687
Snippet name: registerLeftKey - register cursor-left key for a whole JFrame
Eternal ID of this version: #1006687/1
Text MD5: d199615fae16e62e767fe2c3fc8775af
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:05:12
Source code size: 343 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 496 / 538
Referenced in: [show references]