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

29
LINES

< > BotCompany Repo | #1016729 // RAM usage gauge [Dyn Module, still has some repaint problems]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 6028K of libraries. Compilation Failed (18474L/96K).

1  
!7
2  
3  
set flag Processing2.
4  
5  
sclass RAMUsageGuage > DynModule {
6  
  PGauge gauge;
7  
  
8  
  JComponent visualize() {
9  
    // XXX - experimental
10  
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
11  
    
12  
    gauge = pMainAsComponent(PGauge);
13  
    //JComponent panel = singleComponentPanel(gauge);
14  
    //JComponent panel = jfullcenter(gauge);
15  
    JComponent panel = jfullcenter(jFixedSize(gauge.Wsize1, gauge.Wsize2, gauge));
16  
    //JComponent panel = jscroll_centered(jFixedSize(gauge.Wsize1, gauge.Wsize2, gauge));
17  
    awtEveryAndNow(panel, 1000, r actualUpdate);
18  
    ret panel;
19  
  }
20  
  
21  
  void actualUpdate {
22  
    temp enter();
23  
    GlobalMemory m = oshi_systemMemory();
24  
    double percent = 100-percentRatio(m.getAvailable()-m.getSwapUsed(), m.getTotal());
25  
    if (gauge.setValue(percent, iround(percent) + "% of RAM used"))
26  
      gauge.handleDraw();
27  
    setModuleName(gauge.title);
28  
  }
29  
}

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: #1016729
Snippet name: RAM usage gauge [Dyn Module, still has some repaint problems]
Eternal ID of this version: #1016729/12
Text MD5: 0f7501ad817c0855089ff55801f053a1
Transpilation MD5: 6c144744c47d880bbc704ccf6974f3b5
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-30 15:52:25
Source code size: 905 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 374 / 512
Version history: 11 change(s)
Referenced in: [show references]