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

13
LINES

< > BotCompany Repo | #1019019 // tempOnKeyTyped

JavaX fragment (include)

1  
static AutoCloseable tempOnKeyTyped(final int keyCode, final Runnable r, final JComponent a) {
2  
  if (a == null) null;
3  
  final KeyAdapter listener = new {
4  
    @Override
5  
    public void keyTyped(KeyEvent e) {
6  
      print("keycode=" + e.getKeyCode());
7  
      if (e.getKeyCode() == keyCode && e.getModifiers() == 0)
8  
        pcallF(r);
9  
    }
10  
  };
11  
  swing { a.addKeyListener(listener); }
12  
  ret autoCloseable { swing { a.removeKeyListener(listener); } };
13  
}

Author comment

Began life as a copy of #1019018

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019019
Snippet name: tempOnKeyTyped
Eternal ID of this version: #1019019/2
Text MD5: b778211fb3f9bd7d101237cee849d6a5
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-21 12:54:03
Source code size: 460 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 253 / 284
Version history: 1 change(s)
Referenced in: [show references]