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

38
LINES

< > BotCompany Repo | #1001435 // Swing: List VMs with programs [not so nice, shows IDs only]

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

Libraryless. Click here for Pure Java version (2551L/18K/58K).

1  
!752
2  
3  
static JList list;
4  
static int delay = 3000;
5  
6  
p {
7  
  JFrame frame = new JFrame("VMs List");
8  
  frame.setBounds(10, 10, 250, 400);
9  
10  
  list = new JList();
11  
  updateList();
12  
  
13  
  frame.getContentPane().add(new JScrollPane(list));
14  
  frame.setVisible(true);
15  
  
16  
  installTimer(list, runnable {
17  
    updateList();
18  
  }, delay);
19  
}
20  
21  
static new MonoThread update;
22  
23  
!include #1001434 // MonoThread
24  
25  
static void updateList() {
26  
  update.run(runnable {
27  
    new L<S> vms;
28  
    for (DialogIO vm : talkToAllVMs()) {
29  
      S pid = vm.ask("what is your process id");
30  
      S progs = vm.ask("which programs are you running (ids only)?");
31  
      new Matches m;
32  
      if (match3("these: *", progs, m))
33  
        progs = unquote(m.m[0]);
34  
      vms.add(pid + ": " + progs);
35  
    }
36  
    fillListWithStrings(list, vms);
37  
  });
38  
}

Author comment

Began life as a copy of #1001430

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001435
Snippet name: Swing: List VMs with programs [not so nice, shows IDs only]
Eternal ID of this version: #1001435/1
Text MD5: 2a21f8310ebd0226c4de00fb61b53ff2
Transpilation MD5: 070e799873f020e6bc60e105c34b16e6
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-30 14:09:20
Source code size: 833 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 670 / 848
Referenced in: [show references]