!7 sclass SystemCPUTrayIcon extends DynBigNumber { transient BufferedImage trayImage; transient TrayIcon trayIcon; start { setDescription("SYSTEM CPU %"); setToolTip("Percentage is per core (max=" + numberOfCores()*100 + "%)"); ownTimer(doEvery(2.0, r actualUpdate)); ownResource(tempTrayIcon(trayIcon = installTrayIcon(trayImage = whiteImage(24, 24), "System CPU"))); } void actualUpdate { double load = systemCPULoad(); setValue(toIntPercent_ceil(load*numberOfCores()) + " %"); int w = trayImage.getWidth(), h = trayImage.getHeight(); copyImagePart(trayImage, 1, 0, trayImage, 0, 0, w-1, h); fillRect(trayImage, w-1, 0, 1, h, blendColor(Color.black, Color.white, load)); trayIcon.setImage(trayImage); } }