1 20 21 package org.jdesktop.jdic.tray; 22 23 24 import org.jdesktop.jdic.tray.internal.ServiceManager; 25 import org.jdesktop.jdic.tray.internal.SystemTrayService; 26 27 28 36 37 public class SystemTray { 38 39 static SystemTrayService sts = (SystemTrayService) 40 ServiceManager.getService(ServiceManager.SYSTEM_TRAY_SERVICE); 41 42 int trayIndex; 43 44 48 private SystemTray() {} 49 50 private SystemTray(int index) { 51 trayIndex = index; 52 } 53 54 58 public static SystemTray getDefaultSystemTray() { 59 return new SystemTray(0); 60 } 61 62 66 public void addTrayIcon(TrayIcon trayIcon) { 67 if (sts != null) { 68 sts.addTrayIcon(trayIcon, trayIcon.getTrayIconService(), trayIndex); 69 } 70 } 71 72 76 public void removeTrayIcon(TrayIcon trayIcon) { 77 if (sts != null) { 78 sts.removeTrayIcon(trayIcon, trayIcon.getTrayIconService(), 79 trayIndex); 80 } 81 } 82 } 83 | Popular Tags |