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

16
LINES

< > BotCompany Repo | #1020450 // onCharDown

JavaX fragment (include)

1  
static <A extends JComponent> A onCharDown(final VF1<Char> onCharDown, final A a) {
2  
  if (a != null) swing {
3  
    a.addKeyListener(new KeyAdapter {
4  
      @Override
5  
      public void keyTyped(KeyEvent e) {
6  
        if (e.getModifiers() == 0)
7  
          pcallF(onCharDown, e.getKeyChar());
8  
      }
9  
    });
10  
  }
11  
  ret a;
12  
}
13  
14  
static <A extends JComponent> A onCharDown(A a, VF1<Char> onCharDown) {
15  
  ret onCharDown(onCharDown, a);
16  
}

Author comment

Began life as a copy of #1019018

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020450
Snippet name: onCharDown
Eternal ID of this version: #1020450/3
Text MD5: 849feeb26e2e9a94aeef48b82651813f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-22 18:39:54
Source code size: 438 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 240 / 285
Version history: 2 change(s)
Referenced in: [show references]