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

23
LINES

< > BotCompany Repo | #1020802 // OS Size In Memory Tray Icon [Dyn Module]

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

Uses 6315K of libraries. Click here for Pure Java version (5246L/26K).

1  
!7
2  
3  
cmodule OSSizeTrayIcon > DynPrintLog {
4  
  transient S value; // size in MB
5  
  transient JLabel lbl;
6  
  transient bool _startMinimized = true;
7  
  
8  
  start {
9  
    dm_addTrayIcon(onLeftClick(rThread { print("GC!"); timedGCPlusDeadlockSolving_printAlways(); },
10  
      lbl = dm_fieldLabel_noAutoToolTip('value)));
11  
    componentPopupMenuItems(lbl,
12  
      "Garbage Collect", rThread { dm_gc(); actualUpdate(); },
13  
      "Show Module", rThread dm_showModule,
14  
      "Remove", rThread dm_deleteModule);
15  
    doEveryAndNow(10.0, r actualUpdate);
16  
  }
17  
  
18  
  void actualUpdate {
19  
    long mb = toM(oshi_currentProcessResidentSize());
20  
    setField(value := str(mb));
21  
    toolTip(lbl, "OS size in memory: " + mb + " MB");
22  
  }
23  
}

Author comment

Began life as a copy of #1015915

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020802
Snippet name: OS Size In Memory Tray Icon [Dyn Module]
Eternal ID of this version: #1020802/16
Text MD5: 9e936bd2ac791db6828363fa820ed229
Transpilation MD5: c512060df3d9d6fbd05b3e3f5187446e
Author: stefan
Category: javax / modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-22 14:42:41
Source code size: 726 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 331 / 6845
Version history: 15 change(s)
Referenced in: [show references]