< prev index next >

src/java.desktop/share/classes/java/awt/TrayIcon.java

Print this page

        

*** 34,79 **** import java.util.EventObject; import java.security.AccessControlContext; import java.security.AccessController; /** ! * A <code>TrayIcon</code> object represents a tray icon that can be * added to the {@link SystemTray system tray}. A ! * <code>TrayIcon</code> can have a tooltip (text), an image, a popup * menu, and a set of listeners associated with it. * ! * <p>A <code>TrayIcon</code> can generate various {@link MouseEvent * MouseEvents} and supports adding corresponding listeners to receive ! * notification of these events. <code>TrayIcon</code> processes some * of the events by itself. For example, by default, when the ! * right-mouse click is performed on the <code>TrayIcon</code> it * displays the specified popup menu. When the mouse hovers ! * over the <code>TrayIcon</code> the tooltip is displayed. * ! * <p><strong>Note:</strong> When the <code>MouseEvent</code> is ! * dispatched to its registered listeners its <code>component</code> ! * property will be set to <code>null</code>. (See {@link * java.awt.event.ComponentEvent#getComponent}) The ! * <code>source</code> property will be set to this ! * <code>TrayIcon</code>. (See {@link * java.util.EventObject#getSource}) * * <p><b>Note:</b> A well-behaved {@link TrayIcon} implementation * will assign different gestures to showing a popup menu and * selecting a tray icon. * ! * <p>A <code>TrayIcon</code> can generate an {@link ActionEvent * ActionEvent}. On some platforms, this occurs when the user selects * the tray icon using either the mouse or keyboard. * * <p>If a SecurityManager is installed, the AWTPermission * {@code accessSystemTray} must be granted in order to create * a {@code TrayIcon}. Otherwise the constructor will throw a * SecurityException. * * <p> See the {@link SystemTray} class overview for an example on how ! * to use the <code>TrayIcon</code> API. * * @since 1.6 * @see SystemTray#add * @see java.awt.event.ComponentEvent#getComponent * @see java.util.EventObject#getSource --- 34,79 ---- import java.util.EventObject; import java.security.AccessControlContext; import java.security.AccessController; /** ! * A {@code TrayIcon} object represents a tray icon that can be * added to the {@link SystemTray system tray}. A ! * {@code TrayIcon} can have a tooltip (text), an image, a popup * menu, and a set of listeners associated with it. * ! * <p>A {@code TrayIcon} can generate various {@link MouseEvent * MouseEvents} and supports adding corresponding listeners to receive ! * notification of these events. {@code TrayIcon} processes some * of the events by itself. For example, by default, when the ! * right-mouse click is performed on the {@code TrayIcon} it * displays the specified popup menu. When the mouse hovers ! * over the {@code TrayIcon} the tooltip is displayed. * ! * <p><strong>Note:</strong> When the {@code MouseEvent} is ! * dispatched to its registered listeners its {@code component} ! * property will be set to {@code null}. (See {@link * java.awt.event.ComponentEvent#getComponent}) The ! * {@code source} property will be set to this ! * {@code TrayIcon}. (See {@link * java.util.EventObject#getSource}) * * <p><b>Note:</b> A well-behaved {@link TrayIcon} implementation * will assign different gestures to showing a popup menu and * selecting a tray icon. * ! * <p>A {@code TrayIcon} can generate an {@link ActionEvent * ActionEvent}. On some platforms, this occurs when the user selects * the tray icon using either the mouse or keyboard. * * <p>If a SecurityManager is installed, the AWTPermission * {@code accessSystemTray} must be granted in order to create * a {@code TrayIcon}. Otherwise the constructor will throw a * SecurityException. * * <p> See the {@link SystemTray} class overview for an example on how ! * to use the {@code TrayIcon} API. * * @since 1.6 * @see SystemTray#add * @see java.awt.event.ComponentEvent#getComponent * @see java.util.EventObject#getSource
*** 145,159 **** } SunToolkit.insertTargetMapping(this, AppContext.getAppContext()); } /** ! * Creates a <code>TrayIcon</code> with the specified image. * ! * @param image the <code>Image</code> to be used ! * @throws IllegalArgumentException if <code>image</code> is ! * <code>null</code> * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission --- 145,159 ---- } SunToolkit.insertTargetMapping(this, AppContext.getAppContext()); } /** ! * Creates a {@code TrayIcon} with the specified image. * ! * @param image the {@code Image} to be used ! * @throws IllegalArgumentException if {@code image} is ! * {@code null} * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission
*** 171,188 **** } setImage(image); } /** ! * Creates a <code>TrayIcon</code> with the specified image and * tooltip text. * ! * @param image the <code>Image</code> to be used * @param tooltip the string to be used as tooltip text; if the ! * value is <code>null</code> no tooltip is shown ! * @throws IllegalArgumentException if <code>image</code> is ! * <code>null</code> * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission --- 171,188 ---- } setImage(image); } /** ! * Creates a {@code TrayIcon} with the specified image and * tooltip text. * ! * @param image the {@code Image} to be used * @param tooltip the string to be used as tooltip text; if the ! * value is {@code null} no tooltip is shown ! * @throws IllegalArgumentException if {@code image} is ! * {@code null} * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission
*** 197,215 **** this(image); setToolTip(tooltip); } /** ! * Creates a <code>TrayIcon</code> with the specified image, * tooltip and popup menu. * ! * @param image the <code>Image</code> to be used * @param tooltip the string to be used as tooltip text; if the ! * value is <code>null</code> no tooltip is shown * @param popup the menu to be used for the tray icon's popup ! * menu; if the value is <code>null</code> no popup menu is shown ! * @throws IllegalArgumentException if <code>image</code> is <code>null</code> * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission --- 197,215 ---- this(image); setToolTip(tooltip); } /** ! * Creates a {@code TrayIcon} with the specified image, * tooltip and popup menu. * ! * @param image the {@code Image} to be used * @param tooltip the string to be used as tooltip text; if the ! * value is {@code null} no tooltip is shown * @param popup the menu to be used for the tray icon's popup ! * menu; if the value is {@code null} no popup menu is shown ! * @throws IllegalArgumentException if {@code image} is {@code null} * @throws UnsupportedOperationException if the system tray isn't * supported by the current platform * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @throws SecurityException if {@code accessSystemTray} permission
*** 227,237 **** this(image, tooltip); setPopupMenu(popup); } /** ! * Sets the image for this <code>TrayIcon</code>. The previous * tray icon image is discarded without calling the {@link * java.awt.Image#flush} method — you will need to call it * manually. * * <p> If the image represents an animated image, it will be --- 227,237 ---- this(image, tooltip); setPopupMenu(popup); } /** ! * Sets the image for this {@code TrayIcon}. The previous * tray icon image is discarded without calling the {@link * java.awt.Image#flush} method — you will need to call it * manually. * * <p> If the image represents an animated image, it will be
*** 241,252 **** * details on the size of the displayed image. * * <p> Calling this method with the same image that is currently * being used has no effect. * ! * @throws NullPointerException if <code>image</code> is <code>null</code> ! * @param image the non-null <code>Image</code> to be used * @see #getImage * @see Image * @see SystemTray#add(TrayIcon) * @see TrayIcon#TrayIcon(Image, String) */ --- 241,252 ---- * details on the size of the displayed image. * * <p> Calling this method with the same image that is currently * being used has no effect. * ! * @throws NullPointerException if {@code image} is {@code null} ! * @param image the non-null {@code Image} to be used * @see #getImage * @see Image * @see SystemTray#add(TrayIcon) * @see TrayIcon#TrayIcon(Image, String) */
*** 261,288 **** peer.updateImage(); } } /** ! * Returns the current image used for this <code>TrayIcon</code>. * * @return the image * @see #setImage(Image) * @see Image */ public Image getImage() { return image; } /** ! * Sets the popup menu for this <code>TrayIcon</code>. If ! * <code>popup</code> is <code>null</code>, no popup menu will be ! * associated with this <code>TrayIcon</code>. * ! * <p>Note that this <code>popup</code> must not be added to any * parent before or after it is set on the tray icon. If you add ! * it to some parent, the <code>popup</code> may be removed from * that parent. * * <p>The {@code popup} can be set on one {@code TrayIcon} only. * Setting the same popup on multiple {@code TrayIcon}s will cause * an {@code IllegalArgumentException}. --- 261,288 ---- peer.updateImage(); } } /** ! * Returns the current image used for this {@code TrayIcon}. * * @return the image * @see #setImage(Image) * @see Image */ public Image getImage() { return image; } /** ! * Sets the popup menu for this {@code TrayIcon}. If ! * {@code popup} is {@code null}, no popup menu will be ! * associated with this {@code TrayIcon}. * ! * <p>Note that this {@code popup} must not be added to any * parent before or after it is set on the tray icon. If you add ! * it to some parent, the {@code popup} may be removed from * that parent. * * <p>The {@code popup} can be set on one {@code TrayIcon} only. * Setting the same popup on multiple {@code TrayIcon}s will cause * an {@code IllegalArgumentException}.
*** 293,303 **** * will be displayed or, on some systems, a native version of the * menu may be displayed. * * @throws IllegalArgumentException if the {@code popup} is already * set for another {@code TrayIcon} ! * @param popup a <code>PopupMenu</code> or <code>null</code> to * remove any popup menu * @see #getPopupMenu */ public void setPopupMenu(PopupMenu popup) { if (popup == this.popup) { --- 293,303 ---- * will be displayed or, on some systems, a native version of the * menu may be displayed. * * @throws IllegalArgumentException if the {@code popup} is already * set for another {@code TrayIcon} ! * @param popup a {@code PopupMenu} or {@code null} to * remove any popup menu * @see #getPopupMenu */ public void setPopupMenu(PopupMenu popup) { if (popup == this.popup) {
*** 316,345 **** this.popup = popup; } } /** ! * Returns the popup menu associated with this <code>TrayIcon</code>. * ! * @return the popup menu or <code>null</code> if none exists * @see #setPopupMenu(PopupMenu) */ public PopupMenu getPopupMenu() { return popup; } /** ! * Sets the tooltip string for this <code>TrayIcon</code>. The * tooltip is displayed automatically when the mouse hovers over ! * the icon. Setting the tooltip to <code>null</code> removes any * tooltip text. * * When displayed, the tooltip string may be truncated on some platforms; * the number of characters that may be displayed is platform-dependent. * * @param tooltip the string for the tooltip; if the value is ! * <code>null</code> no tooltip is shown * @see #getToolTip */ public void setToolTip(String tooltip) { this.tooltip = tooltip; --- 316,345 ---- this.popup = popup; } } /** ! * Returns the popup menu associated with this {@code TrayIcon}. * ! * @return the popup menu or {@code null} if none exists * @see #setPopupMenu(PopupMenu) */ public PopupMenu getPopupMenu() { return popup; } /** ! * Sets the tooltip string for this {@code TrayIcon}. The * tooltip is displayed automatically when the mouse hovers over ! * the icon. Setting the tooltip to {@code null} removes any * tooltip text. * * When displayed, the tooltip string may be truncated on some platforms; * the number of characters that may be displayed is platform-dependent. * * @param tooltip the string for the tooltip; if the value is ! * {@code null} no tooltip is shown * @see #getToolTip */ public void setToolTip(String tooltip) { this.tooltip = tooltip;
*** 349,383 **** } } /** * Returns the tooltip string associated with this ! * <code>TrayIcon</code>. * ! * @return the tooltip string or <code>null</code> if none exists * @see #setToolTip(String) */ public String getToolTip() { return tooltip; } /** * Sets the auto-size property. Auto-size determines whether the * tray image is automatically sized to fit the space allocated * for the image on the tray. By default, the auto-size property ! * is set to <code>false</code>. * ! * <p> If auto-size is <code>false</code>, and the image size * doesn't match the tray icon space, the image is painted as-is * inside that space — if larger than the allocated space, it will * be cropped. * ! * <p> If auto-size is <code>true</code>, the image is stretched or shrunk to * fit the tray icon space. * ! * @param autosize <code>true</code> to auto-size the image, ! * <code>false</code> otherwise * @see #isImageAutoSize */ public void setImageAutoSize(boolean autosize) { this.autosize = autosize; --- 349,383 ---- } } /** * Returns the tooltip string associated with this ! * {@code TrayIcon}. * ! * @return the tooltip string or {@code null} if none exists * @see #setToolTip(String) */ public String getToolTip() { return tooltip; } /** * Sets the auto-size property. Auto-size determines whether the * tray image is automatically sized to fit the space allocated * for the image on the tray. By default, the auto-size property ! * is set to {@code false}. * ! * <p> If auto-size is {@code false}, and the image size * doesn't match the tray icon space, the image is painted as-is * inside that space — if larger than the allocated space, it will * be cropped. * ! * <p> If auto-size is {@code true}, the image is stretched or shrunk to * fit the tray icon space. * ! * @param autosize {@code true} to auto-size the image, ! * {@code false} otherwise * @see #isImageAutoSize */ public void setImageAutoSize(boolean autosize) { this.autosize = autosize;
*** 388,416 **** } /** * Returns the value of the auto-size property. * ! * @return <code>true</code> if the image will be auto-sized, ! * <code>false</code> otherwise * @see #setImageAutoSize(boolean) */ public boolean isImageAutoSize() { return autosize; } /** * Adds the specified mouse listener to receive mouse events from ! * this <code>TrayIcon</code>. Calling this method with a ! * <code>null</code> value has no effect. * * <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received * from the {@code TrayIcon}) are relative to the screen, not the * {@code TrayIcon}. * ! * <p> <b>Note: </b>The <code>MOUSE_ENTERED</code> and ! * <code>MOUSE_EXITED</code> mouse events are not supported. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent --- 388,416 ---- } /** * Returns the value of the auto-size property. * ! * @return {@code true} if the image will be auto-sized, ! * {@code false} otherwise * @see #setImageAutoSize(boolean) */ public boolean isImageAutoSize() { return autosize; } /** * Adds the specified mouse listener to receive mouse events from ! * this {@code TrayIcon}. Calling this method with a ! * {@code null} value has no effect. * * <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received * from the {@code TrayIcon}) are relative to the screen, not the * {@code TrayIcon}. * ! * <p> <b>Note: </b>The {@code MOUSE_ENTERED} and ! * {@code MOUSE_EXITED} mouse events are not supported. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent
*** 425,435 **** mouseListener = AWTEventMulticaster.add(mouseListener, listener); } /** * Removes the specified mouse listener. Calling this method with ! * <code>null</code> or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent --- 425,435 ---- mouseListener = AWTEventMulticaster.add(mouseListener, listener); } /** * Removes the specified mouse listener. Calling this method with ! * {@code null} or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent
*** 444,457 **** mouseListener = AWTEventMulticaster.remove(mouseListener, listener); } /** * Returns an array of all the mouse listeners ! * registered on this <code>TrayIcon</code>. * ! * @return all of the <code>MouseListeners</code> registered on ! * this <code>TrayIcon</code> or an empty array if no mouse * listeners are currently registered * * @see #addMouseListener(MouseListener) * @see #removeMouseListener(MouseListener) * @see java.awt.event.MouseListener --- 444,457 ---- mouseListener = AWTEventMulticaster.remove(mouseListener, listener); } /** * Returns an array of all the mouse listeners ! * registered on this {@code TrayIcon}. * ! * @return all of the {@code MouseListeners} registered on ! * this {@code TrayIcon} or an empty array if no mouse * listeners are currently registered * * @see #addMouseListener(MouseListener) * @see #removeMouseListener(MouseListener) * @see java.awt.event.MouseListener
*** 460,477 **** return AWTEventMulticaster.getListeners(mouseListener, MouseListener.class); } /** * Adds the specified mouse listener to receive mouse-motion ! * events from this <code>TrayIcon</code>. Calling this method ! * with a <code>null</code> value has no effect. * * <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received * from the {@code TrayIcon}) are relative to the screen, not the * {@code TrayIcon}. * ! * <p> <b>Note: </b>The <code>MOUSE_DRAGGED</code> mouse event is not supported. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent --- 460,477 ---- return AWTEventMulticaster.getListeners(mouseListener, MouseListener.class); } /** * Adds the specified mouse listener to receive mouse-motion ! * events from this {@code TrayIcon}. Calling this method ! * with a {@code null} value has no effect. * * <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received * from the {@code TrayIcon}) are relative to the screen, not the * {@code TrayIcon}. * ! * <p> <b>Note: </b>The {@code MOUSE_DRAGGED} mouse event is not supported. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent
*** 486,496 **** mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener); } /** * Removes the specified mouse-motion listener. Calling this method with ! * <code>null</code> or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent --- 486,496 ---- mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener); } /** * Removes the specified mouse-motion listener. Calling this method with ! * {@code null} or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the mouse listener * @see java.awt.event.MouseEvent
*** 505,518 **** mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, listener); } /** * Returns an array of all the mouse-motion listeners ! * registered on this <code>TrayIcon</code>. * ! * @return all of the <code>MouseInputListeners</code> registered on ! * this <code>TrayIcon</code> or an empty array if no mouse * listeners are currently registered * * @see #addMouseMotionListener(MouseMotionListener) * @see #removeMouseMotionListener(MouseMotionListener) * @see java.awt.event.MouseMotionListener --- 505,518 ---- mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, listener); } /** * Returns an array of all the mouse-motion listeners ! * registered on this {@code TrayIcon}. * ! * @return all of the {@code MouseInputListeners} registered on ! * this {@code TrayIcon} or an empty array if no mouse * listeners are currently registered * * @see #addMouseMotionListener(MouseMotionListener) * @see #removeMouseMotionListener(MouseMotionListener) * @see java.awt.event.MouseMotionListener
*** 522,543 **** } /** * Returns the command name of the action event fired by this tray icon. * ! * @return the action command name, or <code>null</code> if none exists * @see #addActionListener(ActionListener) * @see #setActionCommand(String) */ public String getActionCommand() { return actionCommand; } /** * Sets the command name for the action event fired by this tray * icon. By default, this action command is set to ! * <code>null</code>. * * @param command a string used to set the tray icon's * action command. * @see java.awt.event.ActionEvent * @see #addActionListener(ActionListener) --- 522,543 ---- } /** * Returns the command name of the action event fired by this tray icon. * ! * @return the action command name, or {@code null} if none exists * @see #addActionListener(ActionListener) * @see #setActionCommand(String) */ public String getActionCommand() { return actionCommand; } /** * Sets the command name for the action event fired by this tray * icon. By default, this action command is set to ! * {@code null}. * * @param command a string used to set the tray icon's * action command. * @see java.awt.event.ActionEvent * @see #addActionListener(ActionListener)
*** 547,562 **** actionCommand = command; } /** * Adds the specified action listener to receive ! * <code>ActionEvent</code>s from this <code>TrayIcon</code>. * Action events usually occur when a user selects the tray icon, * using either the mouse or keyboard. The conditions in which * action events are generated are platform-dependent. * ! * <p>Calling this method with a <code>null</code> value has no * effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the action listener --- 547,562 ---- actionCommand = command; } /** * Adds the specified action listener to receive ! * {@code ActionEvent}s from this {@code TrayIcon}. * Action events usually occur when a user selects the tray icon, * using either the mouse or keyboard. The conditions in which * action events are generated are platform-dependent. * ! * <p>Calling this method with a {@code null} value has no * effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the action listener
*** 572,582 **** actionListener = AWTEventMulticaster.add(actionListener, listener); } /** * Removes the specified action listener. Calling this method with ! * <code>null</code> or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the action listener * @see java.awt.event.ActionEvent --- 572,582 ---- actionListener = AWTEventMulticaster.add(actionListener, listener); } /** * Removes the specified action listener. Calling this method with ! * {@code null} or an invalid value has no effect. * <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * >AWT Threading Issues</a> for details on AWT's threading model. * * @param listener the action listener * @see java.awt.event.ActionEvent
*** 592,605 **** actionListener = AWTEventMulticaster.remove(actionListener, listener); } /** * Returns an array of all the action listeners ! * registered on this <code>TrayIcon</code>. * ! * @return all of the <code>ActionListeners</code> registered on ! * this <code>TrayIcon</code> or an empty array if no action * listeners are currently registered * * @see #addActionListener(ActionListener) * @see #removeActionListener(ActionListener) * @see java.awt.event.ActionListener --- 592,605 ---- actionListener = AWTEventMulticaster.remove(actionListener, listener); } /** * Returns an array of all the action listeners ! * registered on this {@code TrayIcon}. * ! * @return all of the {@code ActionListeners} registered on ! * this {@code TrayIcon} or an empty array if no action * listeners are currently registered * * @see #addActionListener(ActionListener) * @see #removeActionListener(ActionListener) * @see java.awt.event.ActionListener
*** 631,658 **** /** * 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"); } --- 631,658 ---- /** * 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"); }
< prev index next >