本文整理匯總了Java中java.awt.TrayIcon.MessageType方法的典型用法代碼示例。如果您正苦於以下問題:Java TrayIcon.MessageType方法的具體用法?Java TrayIcon.MessageType怎麽用?Java TrayIcon.MessageType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.TrayIcon
的用法示例。
在下文中一共展示了TrayIcon.MessageType方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showMessageTray
import java.awt.TrayIcon; //導入方法依賴的package包/類
/**
* Показать сообщение в системном трее
*
* @param message текст сообщения
* @param type тип сообщения
*/
synchronized public void showMessageTray(String caption, String message, MessageType type) {
TrayIcon.MessageType t = TrayIcon.MessageType.NONE;
switch (type) {
case ERROR: {
t = TrayIcon.MessageType.ERROR;
break;
}
case WARNING: {
t = TrayIcon.MessageType.WARNING;
break;
}
case INFO: {
t = TrayIcon.MessageType.INFO;
break;
}
}
trayIcon.displayMessage(caption, message, t);
}
示例2: sendNotification
import java.awt.TrayIcon; //導入方法依賴的package包/類
private void sendNotification(
final String title,
final String message,
final TrayIcon.MessageType type,
final String subtitle)
{
final String escapedTitle = SHELL_ESCAPE.escape(title);
final String escapedMessage = SHELL_ESCAPE.escape(message);
final String escapedSubtitle = subtitle != null ? SHELL_ESCAPE.escape(subtitle) : null;
switch (DETECTED_OS)
{
case Linux:
sendLinuxNotification(escapedTitle, escapedMessage, type);
break;
case MacOS:
sendMacNotification(escapedTitle, escapedMessage, escapedSubtitle);
break;
default:
sendTrayNotification(title, message, type);
}
}
示例3: sendTrayNotification
import java.awt.TrayIcon; //導入方法依賴的package包/類
private void sendTrayNotification(
final String title,
final String message,
final TrayIcon.MessageType type)
{
if (trayIcon != null)
{
trayIcon.displayMessage(title, message, type);
}
}
示例4: sendLinuxNotification
import java.awt.TrayIcon; //導入方法依賴的package包/類
private void sendLinuxNotification(
final String title,
final String message,
final TrayIcon.MessageType type)
{
final List<String> commands = new ArrayList<>();
commands.add("notify-send");
commands.add(title);
commands.add(message);
commands.add("-u");
commands.add(toUrgency(type));
sendCommand(commands);
}
示例5: toUrgency
import java.awt.TrayIcon; //導入方法依賴的package包/類
private static String toUrgency(TrayIcon.MessageType type)
{
switch (type)
{
case WARNING:
case ERROR:
return "critical";
default:
return "normal";
}
}
示例6: notify
import java.awt.TrayIcon; //導入方法依賴的package包/類
public void notify(String message, TrayIcon.MessageType type)
{
sendNotification(appName, message, type, null);
Toolkit.getDefaultToolkit().beep();
}
示例7: displayMessage
import java.awt.TrayIcon; //導入方法依賴的package包/類
void displayMessage(String caption, String text, TrayIcon.MessageType type) {
trayIcon.displayMessage(caption, text, type);
}
示例8: sendMessage
import java.awt.TrayIcon; //導入方法依賴的package包/類
void sendMessage(String title, String content, TrayIcon.MessageType type) {
Popup popup = new Popup(title, content, type);
if (popups.add(popup)) {
UiModule.getInstance().displayMessage(title, content, type);
}
}
示例9: Popup
import java.awt.TrayIcon; //導入方法依賴的package包/類
private Popup(String title, String content, TrayIcon.MessageType type) {
this.title = title;
this.content = content;
this.type = type;
}
示例10: showPopup
import java.awt.TrayIcon; //導入方法依賴的package包/類
public void showPopup(String title, String content, TrayIcon.MessageType type) {
popupManager.sendMessage(title, content, type);
}
示例11: displayMessage
import java.awt.TrayIcon; //導入方法依賴的package包/類
void displayMessage(String caption, String text, TrayIcon.MessageType type) {
trayManager.displayMessage(caption, text, type);
}