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

20
LINES

< > BotCompany Repo | #1010770 // Global Hotkey (Escape)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 408K of libraries. Click here for Pure Java version (7783L/53K).

!7

p {
  autoRestart();
  onGlobalKeyPress(voidfunc(NativeKeyEvent e) {
    if (hasActiveFrameInVM() && !isActiveFrame(consoleFrame())) ret;
    print("Key press: " + e.getKeyCode();
    if (e.getKeyCode() == 1 /* Escape */ && e.getModifiers() == 0) {
      final JTextField tf = jtextfield();
      showCenteredFormTitled("Yup!", "Whaddayawant", tf, r {
        handle(getText(tf))
      });
    }
  });
}

svoid handle(S s) {
  logQuotedWithTime("User typed: " + s);
  infoBox(s);
}

Author comment

Began life as a copy of #1010549

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010770
Snippet name: Global Hotkey (Escape)
Eternal ID of this version: #1010770/13
Text MD5: 5d082807fa17a79ef72a5ba2f47614c2
Transpilation MD5: 886ae0bbb6ff752996d81b7156e8570b
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-10 19:54:23
Source code size: 504 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 425 / 6855
Version history: 12 change(s)
Referenced in: [show references]