本文整理汇总了Java中java.awt.TrayIcon.MessageType类的典型用法代码示例。如果您正苦于以下问题:Java MessageType类的具体用法?Java MessageType怎么用?Java MessageType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageType类属于java.awt.TrayIcon包,在下文中一共展示了MessageType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processEvent
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
@Override
protected void processEvent(InboxChangeEvent event) throws IOException {
// TODO Auto-generated method stub
if (SystemTray.isSupported()) {
if(event.getUnreadItemCount() > 0) {
trayIcon.setImage(this.imageNewMail);
} else {
trayIcon.setImage(this.imageNoMail);
}
if(OwaNotifier.getInstance().getProps().getProperty("notification.type").contentEquals("system")) {
trayIcon.displayMessage(event.getEventTitle(), event.getEventText(), MessageType.INFO);
}
} else {
logger.error("System tray not supported!");
}
if(event.getUnreadItemCount() > 0) {
this.setToolTip(event.getUnreadItemCount() + " message(s) non lu");
} else {
this.setToolTip("Pas de message non lu");
}
}
示例2: showError
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
private void showError(final String description, final Throwable e) {
if(trayIcon != null && iliasProperties.isShowNotifications()){
trayIcon.displayMessage(APP_NAME, "Fehler: "+ description, MessageType.ERROR);
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if(trayIcon != null){
trayIcon.removeActionListener(this);
}
showError(mainFrame, description, e);
}
});
}else{
showError(mainFrame, description, e);
}
}
示例3: syncFinished
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
@Override
public void syncFinished() {
mainFrame.getProgressBar().setVisible(false);
mainFrame.getButtonSync().setText(MainFrame.SYNCHRONISIERE);
if(iliasProperties.isShowNotifications() && trayIcon != null){
int updatedFileCount = 0;
int errorFileCount = 0;
for(val f : fileObjectTableModel.getRowObjects()){
switch(f.getSyncState()){
case UPDATED: updatedFileCount++; break;
case ERROR: errorFileCount++; break;
case CORRUPT: errorFileCount++; break;
default: break;
}
}
if(updatedFileCount > 0 || errorFileCount > 0){
trayIcon.displayMessage(APP_NAME, "Aktualisiert: " + updatedFileCount + (errorFileCount > 0 ? " Fehler: " + errorFileCount : ""), MessageType.INFO);
}
}
}
示例4: createAudioInputStream
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
/**
* Creates the audio input stream.
*
* @param file
* the file
* @param updateComponents
* the update components
*/
public void createAudioInputStream(File file, boolean updateComponents) {
if (file != null && file.isFile()) {
try {
this.file = file;
errStr = null;
audioInputStream = AudioSystem.getAudioInputStream(file);
playB.setEnabled(true);
// fileName = file.getName();
long milliseconds = (long) ((audioInputStream.getFrameLength() * 1000) / audioInputStream.getFormat().getFrameRate());
duration = milliseconds / 1000.0;
saveB.setEnabled(true);
if (updateComponents) {
formatControls.setFormat(audioInputStream.getFormat());
if (isDrawingRequired) samplingGraph.createWaveForm(null);
}
} catch (Exception ex) {
reportStatus(ex.toString(), MessageType.ERROR);
}
}
else {
reportStatus("Audio file required.", MessageType.INFO);
}
}
示例5: parseMessages
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
private List<EclipseMessage> parseMessages(StringWriter errorOut) {
List<EclipseMessage> messages = new LinkedList<EclipseMessage>();
for (String item : errorOut.toString().split("----------")) {
item = item.trim();
if (item.isEmpty())
continue;
String[] parts = item.split(Strings.lineSeparator);
if (parts.length < 4)
continue;
String place = parts[1].trim();
String msg = parts[3].trim();
String first = parts[0].trim();
parts = first.split(" in ");
String[] subParts = parts[0].split(". ");
int id = Integer.parseInt(subParts[0]);
MessageType mtype = MessageType.valueOf(subParts[1]);
subParts = parts[1].split(" \\(at line ");
if (subParts.length != 2)
continue;
File file = new File(subParts[0].trim());
int line = Integer.parseInt(subParts[1].replace(')', ' ').trim());
messages.add(new EclipseMessage(file, id, mtype, line, place, msg));
}
return messages;
}
示例6: reloadShare
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
public PanboxShare reloadShare(PanboxShare share) {
showTrayMessage(bundle.getString("client.warn"),
MessageFormat.format(bundle.getString("client.shareReloadNotification"), share.getName()),
MessageType.WARNING);
try {
PanboxShare nshare = shareManager.reloadShareMetadata(share);
PanboxShare tmp;
if ((tmp = checkShareIntegrity(share)) != null) {
nshare = tmp;
}
int index = shareList.indexOf(share);
if (index != -1) {
shareList.setElementAt(nshare, index);
} else {
logger.error("Could not find share instance " + share + " in shareList");
}
getMainWindow().refreshShare();
return nshare;
} catch (ShareManagerException e) {
JOptionPane.showMessageDialog(null, bundle.getString("client.error.shareReloadFailed"),
bundle.getString("error"), JOptionPane.ERROR_MESSAGE);
}
return null;
}
示例7: addShare
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
public void addShare(PanboxShare newShare) {
char[] password = null;
try {
password = PasswordEnterDialog.invoke(PermissionType.SHARE);
client.showTrayMessage(bundle.getString("PleaseWait"),
bundle.getString("tray.addShare.message"), MessageType.INFO);
client.addShare(newShare, password);
enableDisableAddDeviceContactForShare();
// Also update share list for selected device
if (device != null) {
deviceShareList.setModel(client.getDeviceShares(device));
}
} finally {
if (password != null) {
Utils.eraseChars(password);
}
}
}
示例8: action
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
@Override
public void action(final SocketTesterVO entry) {
log.debug("Action on SocketTesterAction: " + entry);
StringBuffer sb = new StringBuffer();
sb.append("Environment Problems");
if (entry.getName() != null) {
sb.append(" - ").append(entry.getName());
}
if (entry.getHost() != null) {
sb.append(" - ").append(entry.getHost()).append(":").append(entry.getPort());
}
if (entry.getService() != null) {
sb.append(" - Service: ").append(entry.getService());
}
TaskerboxTrayUtils.displayMessage("Taskerbox - Socket Tester", sb.toString(),
MessageType.ERROR, this.actionListener);
}
示例9: displayMessage
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
/**
* Displays a message at the system tray
*
* @param caption
* @param text
* @param messageType
* @param listener
*/
public static void displayMessage(String caption, String text, MessageType messageType,
ActionListener listener) {
log.info(messageType + ": " + text);
if (SystemTray.isSupported()) {
removeAllListeners();
if (listener != null) {
getTrayIcon().addActionListener(listener);
}
getTrayIcon().displayMessage(caption, text, messageType);
}
}
示例10: pastebinUpload
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
public pastebinUpload(String content) {
this.content = content;
try{
if(!uploadTxt().contains("http://")) {
JOptionPane.showMessageDialog(null,
"Error! use FTP server for text uploads",
"Error!", JOptionPane.ERROR_MESSAGE);
} else {
System.out.println(uploadTxt());
String link = uploadTxt();
String linkSplit[] = link.split("com/");
String name = linkSplit[1];
mainWindow.tray.displayMessage("Successfully uploaded!", "Image Uploaded, URL has been copied to clipboard.", MessageType.INFO);
mainWindow.model.insertRow(0, new Object[] { name, "0" + "KB","<html><a href='" + link + "'>" + link + "</a></html>" });
StringSelection stringSelection = new StringSelection(link);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, null);
}
}catch(Exception e){e.printStackTrace();}
}
示例11: showMessage
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
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);
}
}
示例12: update
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
/**
* @inheritDoc
*/
@Override
public void update(Observable arg0, Object arg1) {
ModelNotification notificationType = (ModelNotification) arg1;
switch(notificationType) {
case LIST_OF_PARTICIPANTS_CHANGED:
break;
case LANGUAGE_CHANGED:
refreshLabels();
break;
case MESSAGE_RECEIVED:
if(chatGuiMinimizedToTray) {
trayIcon.displayMessage(constsAndProps.getLanguage().getLabel("notification_newmessage"), chatHistory.getLatestMessage().toString(), MessageType.INFO);
}
break;
}
}
示例13: append
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
@Override
protected void append(ILoggingEvent eventObject) {
final MessageType type;
Level level = eventObject.getLevel();
if (level.isGreaterOrEqual(Level.ERROR)) {
type = MessageType.ERROR;
} else if (level.isGreaterOrEqual(Level.WARN)) {
type = MessageType.WARNING;
} else {
type = MessageType.INFO;
}
final String caption = level.toString();
final String text = eventObject.getFormattedMessage();
final TrayIcon i = icon;
if (i != null) {
EventQueue.invokeLater(new Runnable() {
public void run() {
i.displayMessage(caption, text, type);
}
});
}
}
示例14: addIconActionListener
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
private static void addIconActionListener(final MainWindow mainWindow, final ZayfTrayIcon icon)
{
icon.addIconActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
boolean show = !mainWindow.isVisible();
if (!show)
{
icon.displayMessage("Zayf is minimized",
"Double-click to restore. Right-click and select 'exit' to close",
MessageType.INFO);
}
mainWindow.setVisible(show);
}
});
}
示例15: onMessage
import java.awt.TrayIcon.MessageType; //导入依赖的package包/类
public void onMessage(String channel, String sender,
String login, String hostname, String message) {
String tmpMessage = message;
if(!isBlockedUser(sender)){
tmpMessage = readEmote ? urlReplace(tmpMessage) : urlReplace(emoteReplace(tmpMessage));
tmpMessage = readName ? tmpMessage+", "+sender : tmpMessage;
if(useEnglish && isEnglish(message)) sapi.speakAsyMsg(wordReplaceEN(tmpMessage));
else talker.talk(wordReplaceJP(tmpMessage));
if(usePopup){
icon.displayMessage(sender, message, MessageType.NONE);
}
}
}