java.lang.ObjectAjava.awt.TrayIcon
TrayIcon
object represents a tray icon that can be
added to the system tray . A
TrayIcon
can have a tooltip (text), an image, a popup
menu, and a set of listeners associated with it.
A TrayIcon
can generate various MouseEvents and supports adding corresponding listeners to receive
notification of these events. TrayIcon
processes some
of the events by itself. For example, by default, when the
right-mouse click is performed on the TrayIcon
it
displays the specified popup menu. When the mouse hovers
over the TrayIcon
the tooltip is displayed.
Note: When the MouseEvent
is
dispatched to its registered listeners its component
property will be set to null
. (See java.awt.event.ComponentEvent#getComponent ) The
source
property will be set to this
TrayIcon
. (See java.util.EventObject#getSource )
Note: A well-behaved TrayIcon implementation will assign different gestures to showing a popup menu and selecting a tray icon.
A TrayIcon
can generate an ActionEvent . On some platforms, this occurs when the user selects
the tray icon using either the mouse or keyboard.
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.
See the SystemTray class overview for an example on how
to use the TrayIcon
API.
1.6
- Bino
- GeorgeDenis
- MikhalkinSharon
- ZakhourAnton
- TarasovNested Class Summary: | ||
---|---|---|
public enum class | TrayIcon.MessageType | The message type determines which icon will be displayed in the caption of the message, and a possible system sound a message may generate upon showing. |
Field Summary | ||
---|---|---|
transient MouseListener | mouseListener | |
transient MouseMotionListener | mouseMotionListener | |
transient ActionListener | actionListener |
Constructor: |
---|
TrayIcon with the specified image.
|
TrayIcon with the specified image and
tooltip text.
|
TrayIcon with the specified image,
tooltip and popup menu.
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from java.awt.TrayIcon Detail: |
---|
ActionEvent s from this 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.
Calling this method with a Refer to AWT Threading Issues for details on AWT's threading model. |
TrayIcon . Calling this method with a
null value has no effect.
Note: The {@code MouseEvent}'s coordinates (received from the {@code TrayIcon}) are relative to the screen, not the {@code TrayIcon}. Note: The Refer to AWT Threading Issues for details on AWT's threading model. |
TrayIcon . Calling this method
with a null value has no effect.
Note: The {@code MouseEvent}'s coordinates (received from the {@code TrayIcon}) are relative to the screen, not the {@code TrayIcon}. Note: The Refer to AWT Threading Issues for details on AWT's threading model. |
|
|
Either the caption or the text may be Note: Some platforms may not support showing a message. |
|
|
TrayIcon . |
|
TrayIcon . |
TrayIcon . |
TrayIcon . |
TrayIcon . |
|
TrayIcon . |
|
|
|
|
|
null or an invalid value has no effect.
Refer to AWT Threading Issues for details on AWT's threading model. |
null or an invalid value has no effect.
Refer to AWT Threading Issues for details on AWT's threading model. |
null or an invalid value has no effect.
Refer to AWT Threading Issues for details on AWT's threading model. |
|
null . |
|
TrayIcon . The previous
tray icon image is discarded without calling the java.awt.Image#flush method you will need to call it
manually.
If the image represents an animated image, it will be animated automatically. See the #setImageAutoSize(boolean) property for details on the size of the displayed image. Calling this method with the same image that is currently being used has no effect. |
false .
If auto-size is If auto-size is |
TrayIcon . If
popup is null , no popup menu will be
associated with this TrayIcon .
Note that this 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}. Note: Some platforms may not support showing the user-specified popup menu component when the user right-clicks the tray icon. In this situation, either no menu will be displayed or, on some systems, a native version of the menu may be displayed. |
TrayIcon . The
tooltip is displayed automatically when the mouse hovers over
the icon. Setting the tooltip to 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. |