类java.awt.TrayIcon.MessageType源码实例Demo

下面列出了怎么用java.awt.TrayIcon.MessageType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: JPPF   文件: NodeSystemTray.java
@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();
  }
}
 
源代码2 项目: PeerWasp   文件: JSystemTray.java
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);
	}

}
 
源代码3 项目: JPPF   文件: NodeSystemTray.java
@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();
  }
}
 
源代码4 项目: Library-Assistant   文件: AlertMaker.java
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();
    }
}
 
源代码5 项目: MtgDesktopCompanion   文件: OSTrayNotifier.java
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;
	}
}
 
源代码6 项目: send-notification   文件: SystemTrayNotifier.java
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;
    }
}
 
源代码7 项目: PeerWasp   文件: JSystemTray.java
/**
 * 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);
}
 
源代码8 项目: PeerWasp   文件: JSystemTray.java
@Override
@Handler
public void showFileEvents(AggregatedFileEventStatus event) {
	String msg = generateAggregatedFileEventStatusMessage(event);
	ActionListener listener = new ShowSettingsActionListener();
	setNewMessageActionListener(listener);
	showMessage("File Synchronization", msg, MessageType.INFO);
}
 
源代码9 项目: NBANDROID-V2   文件: Installer.java
@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);

}
 
源代码10 项目: rscplus   文件: NotificationsHandler.java
/**
 * 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("@[email protected]", "").replaceAll("~...~", "").replaceAll("\\\\", "\\\\\\\\");

  if (Settings.USE_SYSTEM_NOTIFICATIONS.get(Settings.currentProfile)
      && !System.getProperty("os.name").contains("Windows")) {
    if (!hasNotifySend) {
      Client.displayMessage(
          "@[email protected] have to install notify-send for native system notifications!",
          Client.CHAT_QUEST);
      Client.displayMessage(
          "@[email protected](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());
}
 
源代码11 项目: PeerWasp   文件: JSystemTray.java
@Override
public void showInformationMessage(String title, String message) {
	setNewMessageActionListener(null);
	showMessage(title, message, MessageType.INFO);
}
 
 类所在包
 类方法
 同包方法