public void install() { try { if (trayIcon == null && SystemTray.isSupported()) { SystemTray systemTray = SystemTray.getSystemTray(); Dimension size = systemTray.getTrayIconSize(); trayIcon = createTrayIcon(size); systemTray.add(trayIcon); JPopupMenu popup = new JPopupMenu(); trayIcon.setJPopupMenu(popup); createPopup(popup); } } catch (AWTException e) { e.printStackTrace(); } }
public void setToolTip(String toolTip) { if (trayIcon != null) trayIcon.setToolTip(toolTip); }
public void addMouseListener(MouseListener listener) { if (trayIcon != null) trayIcon.addMouseListener(listener); }