本文整理汇总了Java中java.awt.peer.TrayIconPeer.displayMessage方法的典型用法代码示例。如果您正苦于以下问题:Java TrayIconPeer.displayMessage方法的具体用法?Java TrayIconPeer.displayMessage怎么用?Java TrayIconPeer.displayMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.TrayIconPeer
的用法示例。
在下文中一共展示了TrayIconPeer.displayMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayMessage
import java.awt.peer.TrayIconPeer; //导入方法依赖的package包/类
/**
* Displays a popup message near the tray icon. The message will
* disappear after a time or if the user clicks on it. Clicking
* on the message may trigger an {@code ActionEvent}.
*
* <p>Either the caption or the text may be <code>null</code>, but an
* <code>NullPointerException</code> is thrown if both are
* <code>null</code>.
*
* When displayed, the caption or text strings may be truncated on
* some platforms; the number of characters that may be displayed is
* platform-dependent.
*
* <p><strong>Note:</strong> Some platforms may not support
* showing a message.
*
* @param caption the caption displayed above the text, usually in
* bold; may be <code>null</code>
* @param text the text displayed for the particular message; may be
* <code>null</code>
* @param messageType an enum indicating the message type
* @throws NullPointerException if both <code>caption</code>
* and <code>text</code> are <code>null</code>
*/
public void displayMessage(String caption, String text, MessageType messageType) {
if (caption == null && text == null) {
throw new NullPointerException("displaying the message with both caption and text being null");
}
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.displayMessage(caption, text, messageType.name());
}
}
示例2: displayMessage
import java.awt.peer.TrayIconPeer; //导入方法依赖的package包/类
/**
* Displays a popup message near the tray icon. The message will
* disappear after a time or if the user clicks on it. Clicking
* on the message may trigger an {@code ActionEvent}.
*
* <p>Either the caption or the text may be {@code null}, but an
* {@code NullPointerException} is thrown if both are
* {@code null}.
*
* When displayed, the caption or text strings may be truncated on
* some platforms; the number of characters that may be displayed is
* platform-dependent.
*
* <p><strong>Note:</strong> Some platforms may not support
* showing a message.
*
* @param caption the caption displayed above the text, usually in
* bold; may be {@code null}
* @param text the text displayed for the particular message; may be
* {@code null}
* @param messageType an enum indicating the message type
* @throws NullPointerException if both {@code caption}
* and {@code text} are {@code null}
*/
public void displayMessage(String caption, String text, MessageType messageType) {
if (caption == null && text == null) {
throw new NullPointerException("displaying the message with both caption and text being null");
}
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.displayMessage(caption, text, messageType.name());
}
}
示例3: displayMessage
import java.awt.peer.TrayIconPeer; //导入方法依赖的package包/类
/**
* Displays a popup message near the tray icon. The message will
* disappear after a time or if the user clicks on it. Clicking
* on the message may trigger an {@code ActionEvent}.
*
* <p>Either the caption or the text may be <code>null</code>, but an
* <code>NullPointerException</code> is thrown if both are
* <code>null</code>.
*
* When displayed, the caption or text strings may be truncated on
* some platforms; the number of characters that may be displayed is
* platform-dependent.
*
* <p><strong>Note:</strong> Some platforms may not support
* showing a message.
*
* @param caption the caption displayed above the text, usually in
* bold; may be <code>null</code>
* @param text the text displayed for the particular message; may be
* <code>null</code>
* @param messageType an enum indicating the message type
* @throws NullPointerException if both <code>caption</code>
* and <code>text</code> are <code>null</code>
*/
public void displayMessage(String caption, String text, MessageType messageType) {
if (caption == null && text == null) {
throw new NullPointerException("displaying the message with both caption and text being null");
}
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.displayMessage(caption, text, messageType.toString());
}
}