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

29
LINES

< > BotCompany Repo | #1016726 // Show RAM usage as gauge in JFrame (Processing 2, OK)

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

Download Jar. Uses 8319K of libraries. Click here for Pure Java version (6897L/36K).

!7

set flag Processing2.

please include function pMain.

p {
  final PGauge gauge1 = pMain(PGauge);
  Window w = getWindow(gauge1);
  for (WindowListener l : w.getWindowListeners())
    w.removeWindowListener(l);
  getParent(gauge1).remove(gauge1);
  disposeWindow(w);
  showPackedFrame(gauge1);
  printComponentTree(getFrame(gauge1));
  //hideConsole();

  repeat with sleep 1 {
    GlobalMemory m = oshi_systemMemory();
    double percent = 100-percentRatio(m.getAvailable()-m.getSwapUsed(), m.getTotal());
    S title = "RAM used";
    
    // scale to 180
    //pgauge_showDiskSpace(gauge1, title, percent);
    
    // scale to 100
    gauge1.setValue(percent, iround(percent) + "% of " + title);
  }
}

Author comment

Began life as a copy of #1016725

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016726
Snippet name: Show RAM usage as gauge in JFrame (Processing 2, OK)
Eternal ID of this version: #1016726/11
Text MD5: 8a6f14e33e4ee97de52a0c62908ae584
Transpilation MD5: 0ea8f56cf4b521ee5ba12f0cec821d38
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-30 15:09:44
Source code size: 737 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 450 / 920
Version history: 10 change(s)
Referenced in: [show references]