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

!752

static JList list;
static int delay = 3000;

p {
  JFrame frame = new JFrame("VMs List");
  frame.setBounds(10, 10, 250, 400);

  list = new JList();
  updateList();
  
  frame.getContentPane().add(new JScrollPane(list));
  frame.setVisible(true);
  
  installTimer(list, runnable {
    updateList();
  }, delay);
}

static new MonoThread update;

!include #1001434 // MonoThread

static void updateList() {
  update.run(runnable {
    new L<S> vms;
    for (DialogIO vm : talkToAllVMs()) {
      S pid = vm.ask("what is your process id");
      S progs = vm.ask("which programs are you running (ids only)?");
      new Matches m;
      if (match3("these: *", progs, m))
        progs = unquote(m.m[0]);
      vms.add(pid + ": " + progs);
    }
    fillListWithStrings(list, vms);
  });
}

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: 601 / 757
Referenced in: [show references]