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).

1  
!7
2  
3  
p {
4  
  autoRestart();
5  
  onGlobalKeyPress(voidfunc(NativeKeyEvent e) {
6  
    if (hasActiveFrameInVM() && !isActiveFrame(consoleFrame())) ret;
7  
    print("Key press: " + e.getKeyCode();
8  
    if (e.getKeyCode() == 1 /* Escape */ && e.getModifiers() == 0) {
9  
      final JTextField tf = jtextfield();
10  
      showCenteredFormTitled("Yup!", "Whaddayawant", tf, r {
11  
        handle(getText(tf))
12  
      });
13  
    }
14  
  });
15  
}
16  
17  
svoid handle(S s) {
18  
  logQuotedWithTime("User typed: " + s);
19  
  infoBox(s);
20  
}

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: 537 / 7121
Version history: 12 change(s)
Referenced in: [show references]