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

9
LINES

< > BotCompany Repo | #1035314 // functionKeyListener - e.g. F5

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7881L/44K).

static KeyListener functionKeyListener(int functionKeyNr, Runnable action) {
  ret new KeyAdapter {
    public void keyReleased(KeyEvent ke) {
      if (ke.getKeyCode() == KeyEvent.VK_F1+functionKeyNr-1 && ke.getModifiers() == 0) {
        pcallF(action);
      }
    }
  };
}

Author comment

Began life as a copy of #1017557

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035314
Snippet name: functionKeyListener - e.g. F5
Eternal ID of this version: #1035314/3
Text MD5: 0bec6c4057a655d61a6bf456be9e8dbe
Transpilation MD5: d62f148c38d39672caf11c192c9b333e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-30 20:34:03
Source code size: 284 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 212
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1035400 - ctrlLetterKeyListener - e.g. Ctrl+B