Java Code Examples for java.awt.SystemTray#remove()

The following examples show how to use java.awt.SystemTray#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysTray.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void hideTrayIcon() {
    SystemTray tray = SystemTray.getSystemTray();
    if (tray != null) {
        try {
            tray.remove(trayIcon);
        } catch (Exception e) {
            Exceptions.printStackTrace(e);
        }
    }
    trayIcon = null;
}
 
Example 2
Source File: AlertMaker.java    From Library-Assistant with Apache License 2.0 5 votes vote down vote up
public static void showTrayMessage(String title, String message) {
    try {
        SystemTray tray = SystemTray.getSystemTray();
        BufferedImage image = ImageIO.read(AlertMaker.class.getResource(LibraryAssistantUtil.ICON_IMAGE_LOC));
        TrayIcon trayIcon = new TrayIcon(image, "Library Assistant");
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("Library Assistant");
        tray.add(trayIcon);
        trayIcon.displayMessage(title, message, MessageType.INFO);
        tray.remove(trayIcon);
    } catch (Exception exp) {
        exp.printStackTrace();
    }
}
 
Example 3
Source File: Main.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public static void removeTrayIcon() {
    if (SystemTray.isSupported()) {
        SystemTray tray = SystemTray.getSystemTray();
        if (trayIcon != null) {
            tray.remove(trayIcon);
            trayIcon = null;
        }
    }
}
 
Example 4
Source File: SysTrayPlugin.java    From Spark with Apache License 2.0 5 votes vote down vote up
@Override
public void shutdown() {
	if (SystemTray.isSupported()) {
		SystemTray tray = SystemTray.getSystemTray();
		tray.remove(trayIcon);
	}
	ChatManager.getInstance().removeChatMessageHandler(chatMessageHandler);
}
 
Example 5
Source File: TrayManager.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
void removeTray() {
    if (mTrayIcon != null) {
        SystemTray tray = SystemTray.getSystemTray();
        tray.remove(mTrayIcon);
    }
}