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

7
LINES

< > BotCompany Repo | #1016090 // registerEscape_rootPane - register escape key for a whole root pane

JavaX fragment (include)

1  
static void registerEscape_rootPane(JComponent rootPane, final Runnable r) {
2  
  S name = "Escape";
3  
  Action action = abstractAction(name, r);
4  
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
5  
  rootPane.getActionMap().put(name, action);
6  
  rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, name);
7  
}

Author comment

Began life as a copy of #1004500

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: #1016090
Snippet name: registerEscape_rootPane - register escape key for a whole root pane
Eternal ID of this version: #1016090/1
Text MD5: 3ccf5b5c95c3d5a1849eb78431f1b36e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-06 00:13:59
Source code size: 344 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 519 / 520
Referenced in: [show references]