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

16
LINES

< > BotCompany Repo | #1020450 // onCharDown

JavaX fragment (include)

static <A extends JComponent> A onCharDown(final VF1<Char> onCharDown, final A a) {
  if (a != null) swing {
    a.addKeyListener(new KeyAdapter {
      @Override
      public void keyTyped(KeyEvent e) {
        if (e.getModifiers() == 0)
          pcallF(onCharDown, e.getKeyChar());
      }
    });
  }
  ret a;
}

static <A extends JComponent> A onCharDown(A a, VF1<Char> onCharDown) {
  ret onCharDown(onCharDown, a);
}

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: 236 / 280
Version history: 2 change(s)
Referenced in: [show references]