本文整理汇总了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);
}