java.awt.SystemTray.getSystemTray().add(new java.awt.TrayIcon(java.awt.Toolkit.getDefaultToolkit().getImage("foo.png")));
final SystemTray systemTray = SystemTray.getSystemTray(); final TrayIcon trayIcon = new TrayIcon(icon, title); trayIcon.setImageAutoSize(true);
tray = SystemTray.getSystemTray();
trayIcon.setImageAutoSize(true); trayIcon.setPopupMenu(trayMenu); SystemTray.getSystemTray().add(trayIcon); trayIcon.addMouseListener(new MouseAdapter() { @Override
tray=SystemTray.getSystemTray();
if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray();
@Override public Dimension iconSize() { return SystemTray.getSystemTray().getTrayIconSize(); }
@Override public void run() { SystemTray tray = SystemTray.getSystemTray(); try { tray.add(trayIcon); } catch (AWTException e) { throw new RuntimeException(e); } boolean firstRun = config.asBoolean("firstRun", true); if(firstRun) { showWelcomeMessage(trayIcon); config.set("firstRun", false); } }
final SystemTray tray = SystemTray.getSystemTray(); final JFrame frame = (JFrame) e.getSource();
return; tray = SystemTray.getSystemTray(); PropertyChangeListener propListener = new PropertyChangeListener() {
SystemTray systemTray = SystemTray.getSystemTray();
/** * Add the tray icon to the system tray and start everything up. */ public synchronized void startManager() throws AWTException { if (!SystemTray.isSupported()) throw new AWTException("SystemTray not supported"); tray = SystemTray.getSystemTray(); // Windows typically has tooltips; Linux (at least Ubuntu) doesn't String tooltip = SystemVersion.isWindows() ? _t("I2P: Right-click for menu") : null; TrayIcon ti; if (_useSwing) ti = getSwingTrayIcon(tooltip); else ti = getAWTTrayIcon(tooltip); ti.setImageAutoSize(true); //Resize image to fit the system tray tray.add(ti); trayIcon = ti; }
final SystemTray tray = SystemTray.getSystemTray(); Image image = Toolkit.getDefaultToolkit().getImage("gifIcon.gif"); PopupMenu popup = new PopupMenu();
final SystemTray tray = SystemTray.getSystemTray();
public WindowsTrayIcon() { super(new ImageIcon(WindowsTrayIcon.class.getResource(IMAGE_PATH), TOOLTIP).getImage(), TOOLTIP); try { popup = new PopupMenu(); tray = SystemTray.getSystemTray(); instance = this; setup(); } catch (AWTException e) { logger.error("Unable to create tray icon", e); } }
}); final SystemTray tray = SystemTray.getSystemTray();
@Override public void shutdown() { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); tray.remove(trayIcon); } ChatManager.getInstance().removeChatMessageHandler(chatMessageHandler); }
@Override protected void performClose() { if (hasProcess()) { if (killOnClose) { performKill(); } } if (trayIcon != null) { SystemTray.getSystemTray().remove(trayIcon); } super.performClose(); }
public void minimizeToTray() { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); try { tray.add(this.trayIcon); } catch (AWTException ex) { Common.handleErrorMessage(ex, "無法加入系統工具列圖示"); } } else { setState(Frame.ICONIFIED); // 若系統沒有支援縮進系統框,就只好縮小到下方列。 } }
private static void createGui() { JXTrayIcon tray = new JXTrayIcon(createImage()); tray.setJPopuMenu(createJPopupMenu()); try { SystemTray.getSystemTray().add(tray); } catch (AWTException e) { e.printStackTrace(); } }