Beispiel #1
0
  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();
    }
  }
Beispiel #2
0
 public void setToolTip(String toolTip) {
   if (trayIcon != null) trayIcon.setToolTip(toolTip);
 }
Beispiel #3
0
 public void addMouseListener(MouseListener listener) {
   if (trayIcon != null) trayIcon.addMouseListener(listener);
 }