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

24
LINES

< > BotCompany Repo | #1026954 // CPU Temperature Tray Icon

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

Uses 5085K of libraries. Click here for Pure Java version (8573L/40K).

1  
!7
2  
3  
cm CPUTemp > DynBigNumber {
4  
  int digits = 0;
5  
  switchable double interval = 5;
6  
  switchable S pattern = "= $DEG °C =";
7  
  transient JLabel lbl;
8  
  
9  
  start {
10  
    dm_addTrayIcon(lbl = dm_fieldLabel_noAutoToolTip value());
11  
    componentPopupMenuItems(lbl,
12  
      "Show Module", rThreadEnter dm_showModule,
13  
      "Remove", rThreadEnter dm_deleteModule);
14  
    setDescription("CPU TEMP");
15  
    doEveryAndNow(interval, r actualUpdate);
16  
  }
17  
  
18  
  void actualUpdate {
19  
    //time "CPU Temp" { // <= 5 ms
20  
      setValue(replace(pattern, "$DEG", formatDoubleX(oshi_cpuTemperature(), digits)));
21  
    //}
22  
    toolTip(lbl, "CPU temperature: " + value);
23  
  }
24  
}

Author comment

Began life as a copy of #1018430

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026954
Snippet name: CPU Temperature Tray Icon
Eternal ID of this version: #1026954/10
Text MD5: 4ab2b549efa51012ea9a0bd28c2f07a6
Transpilation MD5: ef80ede36cd2d5f079c83ae92ab8914b
Author: stefan
Category: javax / modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-08 17:02:05
Source code size: 666 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 263 / 64872
Version history: 9 change(s)
Referenced in: [show references]