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

!7

cmodule OSSizeTrayIcon > DynPrintLog {
  transient S value; // size in MB
  transient JLabel lbl;
  transient bool _startMinimized = true;
  
  start {
    dm_addTrayIcon(onLeftClick(rThread { print("GC!"); timedGCPlusDeadlockSolving_printAlways(); },
      lbl = dm_fieldLabel_noAutoToolTip('value)));
    componentPopupMenuItems(lbl,
      "Garbage Collect", rThread { dm_gc(); actualUpdate(); },
      "Show Module", rThread dm_showModule,
      "Remove", rThread dm_deleteModule);
    doEveryAndNow(10.0, r actualUpdate);
  }
  
  void actualUpdate {
    long mb = toM(oshi_currentProcessResidentSize());
    setField(value := str(mb));
    toolTip(lbl, "OS size in memory: " + mb + " MB");
  }
}

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: 262 / 6757
Version history: 15 change(s)
Referenced in: [show references]