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

34
LINES

< > BotCompany Repo | #1001738 // Get active Swing component (search all VMs)

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

Libraryless. Click here for Pure Java version (1552L/11K/37K).

1  
!747
2  
!pcall
3  
4  
m {
5  
  p {
6  
    new TreeMap results;
7  
    for (DialogIO vm : talkToAllOtherVMs()) {
8  
      pcall {
9  
        int vmPort = vm.getPort();
10  
        Map<Number, S> bots = (Map) safeUnstructure(vm.ask("list bots"));
11  
        print("VM " + vmPort + " bots: " + structure(bots));
12  
        if (!containsBot(bots, "Get Active Swing Component Bot")) {
13  
          print("Injecting bot.");
14  
          injectTo(vmPort, "#1001734");
15  
        }
16  
        S result = vm.ask("please forward to bot *: *", "Get Active Swing Component Bot", "get active component");
17  
        results.put(vmPort, result);
18  
      }
19  
      vm.close();
20  
    }
21  
    
22  
    // include myself
23  
    results.put(myVMPort(), weakref(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()));
24  
    
25  
    print("Results: " + structure(results));
26  
  }
27  
  
28  
  static boolean containsBot(Map<Number, S> bots, S botName) {
29  
    for (S bot : bots.values())
30  
      if (startsWithIgnoreCase(bot, botName))
31  
        ret true;
32  
    ret false;
33  
  }
34  
}

Author comment

Began life as a copy of #1001720

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001738
Snippet name: Get active Swing component (search all VMs)
Eternal ID of this version: #1001738/1
Text MD5: bc1c91555cfb4732122489427fb51bf5
Transpilation MD5: cac8e5c76adb7ad874825f52c8420a2a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-11-11 01:49:35
Source code size: 1020 bytes / 34 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 689 / 776
Referenced in: [show references]