List of usage examples for java.awt TrayIcon TrayIcon
public TrayIcon(Image image, String tooltip)
From source file:ui.main.MainViewController.java
private void showNotifications(String chat, String message) { // a general method for view notifications -> windows notification if (!isnotifiable.isSelected()) { return;/*from w w w .j ava 2s . co m*/ } URL url = System.class.getResource("/resources/LogoTransparent.png"); java.awt.Image image = Toolkit.getDefaultToolkit().getImage(url); TrayIcon trayIcon = new TrayIcon(image, "Instant Messenger Plus"); if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); trayIcon.setImageAutoSize(true); try { tray.add(trayIcon); } catch (AWTException e) { System.err.println("TrayIcon could not be added."); } trayIcon.displayMessage("IMP: " + chat, message, TrayIcon.MessageType.INFO); } }