java.awt.TrayIcon.MessageType Java Examples
The following examples show how to use
java.awt.TrayIcon.MessageType.
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: NodeSystemTray.java From JPPF with Apache License 2.0 | 6 votes |
@Override public void nodeStarting(final NodeLifeCycleEvent event) { trayIcon.displayMessage("JPPF Node connected", null, MessageType.INFO); if (jmxInfo == null) { try { jmxInfo = event.getNode().getManagementInfo(); } catch (final Exception e) { log.error(e.getMessage(), e); } } lock.lock(); try { // node is disconnected, display the green icon trayIcon.setImage(images[0]); final String s = generateTooltipText(); trayIcon.setToolTip(s); } finally { lock.unlock(); } }
Example #2
Source File: JSystemTray.java From PeerWasp with MIT License | 6 votes |
private void showMessage(String title, String message, MessageType type) { if (!appConfig.isTrayNotificationEnabled()) { return; } if (title == null) { title = ""; } if (message == null) { message = ""; } logger.info("{} Message: \n{}\n{}", type.toString(), title, message); if (trayIcon != null) { trayIcon.displayMessage(title, message, type); } }
Example #3
Source File: NodeSystemTray.java From JPPF with Apache License 2.0 | 5 votes |
@Override public void nodeEnding(final NodeLifeCycleEvent event) { trayIcon.displayMessage("JPPF Node disconnected from the server!", "attempting reconnection ...", MessageType.ERROR); lock.lock(); try { // node is disconnected, display the red icon trayIcon.setImage(images[1]); } finally { lock.unlock(); } }
Example #4
Source File: AlertMaker.java From Library-Assistant with Apache License 2.0 | 5 votes |
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 #5
Source File: OSTrayNotifier.java From MtgDesktopCompanion with GNU General Public License v3.0 | 5 votes |
private MessageType convert(MESSAGE_TYPE type) { switch(type) { case ERROR : return MessageType.ERROR; case INFO : return MessageType.INFO; case WARNING : return MessageType.WARNING; case NONE : return MessageType.NONE; default: return MessageType.INFO; } }
Example #6
Source File: SystemTrayNotifier.java From send-notification with MIT License | 5 votes |
private static MessageType toMessageType(Notification.Level level) { switch (level) { case INFO: return MessageType.INFO; case WARNING: return MessageType.WARNING; case ERROR: return MessageType.ERROR; default: return MessageType.NONE; } }
Example #7
Source File: JSystemTray.java From PeerWasp with MIT License | 5 votes |
/** * NOTIFICATIONS - implementation of the ITrayNotifications interface */ @Override @Handler public void showInformation(InformationNotification in) { ActionListener listener = new ShowActivityActionListener(); setNewMessageActionListener(listener); showMessage(in.getTitle(), in.getMessage(), MessageType.INFO); }
Example #8
Source File: JSystemTray.java From PeerWasp with MIT License | 5 votes |
@Override @Handler public void showFileEvents(AggregatedFileEventStatus event) { String msg = generateAggregatedFileEventStatusMessage(event); ActionListener listener = new ShowSettingsActionListener(); setNewMessageActionListener(listener); showMessage("File Synchronization", msg, MessageType.INFO); }
Example #9
Source File: Installer.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
@Override public void restored() { NbOptionalDependencySpiLoader.installServiceProvider("com.junichi11.netbeans.modules.color.codes.preview.spi.ColorCodesProvider","com.junichi11.netbeans.modules.color.codes.preview", "org.nbandroid.netbeans.gradle.v2.color.preview.AndroidColorCodesProvider", Installer.class); AndroidSdkProvider.getDefault(); //init SDK subsystem Runnable runnable = new Runnable() { public void run() { TerminalContainerTopComponent instance = TerminalContainerTopComponent.findInstance(); instance.putClientProperty(AUTO_OPEN_LOCAL_PROPERTY, Boolean.FALSE); } }; WindowManager.getDefault().invokeWhenUIReady(runnable); RequestProcessor.getDefault().schedule(new Runnable() { @Override public void run() { double version = Double.parseDouble(System.getProperty("java.specification.version")); if (version < 10d) { NotificationDisplayer.getDefault().notify("Unsupported Java Version", loadIcon(), "Apache NetBeans is running Java " + version + " that is not supported by NBANDROID-V2. ", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { String text = "<html>"; text += "Apache NetBeans is running Java " + version + " that is not supported by NBANDROID-V2. <br/><br/>"; text += "Versions supported by NBANDROID-V2: <br/><br/>"; text += "Java 10.x <br/>"; text += "Java 11.x <br/>"; text += "Java 12.x <br/><br/><br/>"; text += "<b>Please update your Java version, otherwise NBANDROID will not work properly!</b><br/>"; text += "</html>"; NotifyDescriptor nd = new NotifyDescriptor.Message(text, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd); } }, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.ERROR); } } private Icon loadIcon() { URL resource = MessageType.class.getResource("images/error.png"); if (resource == null) { return new ImageIcon(); } return new ImageIcon(resource); } }, 20, TimeUnit.SECONDS); }
Example #10
Source File: NotificationsHandler.java From rscplus with GNU General Public License v3.0 | 4 votes |
/** * Displays a notification, playing sound if it is enabled * * <p>TODO: Add fade-in and fade-out or slide-in and slide-out animations * * @param title The title of the notification * @param text Text message of the notification */ public static void displayNotification(final String title, String text, String urgency) { // Remove color/formatting codes final String sanitizedText = text.replaceAll("@...@", "").replaceAll("~...~", "").replaceAll("\\\\", "\\\\\\\\"); if (Settings.USE_SYSTEM_NOTIFICATIONS.get(Settings.currentProfile) && !System.getProperty("os.name").contains("Windows")) { if (!hasNotifySend) { Client.displayMessage( "@red@You have to install notify-send for native system notifications!", Client.CHAT_QUEST); Client.displayMessage( "@red@(restart rsc+ if you have installed notify-send)", Client.CHAT_QUEST); } else { try { String output = execCmd( new String[] { "notify-send", "-u", urgency, "-i", "assets/notification_background.png", title, sanitizedText }); } catch (IOException e) { Logger.Error("Error while running notify-send binary: " + e.getMessage()); e.printStackTrace(); } } } else if (SwingUtilities.isEventDispatchThread()) { if (Settings.USE_SYSTEM_NOTIFICATIONS.get(Settings.currentProfile) && SystemTray.isSupported()) { // TODO: When you click the system notification, it should focus the game client TrayHandler.getTrayIcon().displayMessage(title, sanitizedText, MessageType.NONE); } else { setNotificationWindowVisible(true); notificationTitle.setText(title); notificationTextArea.setText(sanitizedText); notificationFrame.repaint(); } } else { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (Settings.USE_SYSTEM_NOTIFICATIONS.get(Settings.currentProfile) && SystemTray.isSupported()) { // TODO: When you click the system notification, it should focus the game client TrayHandler.getTrayIcon().displayMessage(title, sanitizedText, MessageType.NONE); } else { setNotificationWindowVisible(true); notificationTitle.setText(title); notificationTextArea.setText(sanitizedText); notificationFrame.repaint(); } } }); } setLastNotifTime(System.currentTimeMillis()); }
Example #11
Source File: JSystemTray.java From PeerWasp with MIT License | 4 votes |
@Override public void showInformationMessage(String title, String message) { setNewMessageActionListener(null); showMessage(title, message, MessageType.INFO); }