Class TrayIcon

java.lang.Object
java.awt.TrayIcon

public classTrayIconextendsObject
ATrayIcon object represents a tray icon that can be added to thesystem tray. ATrayIcon can have a tooltip (text), an image, a popup menu, and a set of listeners associated with it.

ATrayIcon can generate variousMouseEvents 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 theTrayIcon it displays the specified popup menu. When the mouse hovers over theTrayIcon the tooltip is displayed (this behaviour is platform dependent).

Note: When theMouseEvent is dispatched to its registered listeners itscomponent property will be set tonull. (SeeComponentEvent.getComponent()) Thesource property will be set to thisTrayIcon. (SeeEventObject.getSource())

Note: A well-behavedTrayIcon implementation will assign different gestures to showing a popup menu and selecting a tray icon.

ATrayIcon can generate anActionEvent. On some platforms, this occurs when the user selects the tray icon using either the mouse or keyboard.

See theSystemTray class overview for an example on how to use theTrayIcon API.

Implementation Note:
When theapple.awt.enableTemplateImages property is set, all images associated with instances of this class are treated as template images by the native desktop system. This means all color information is discarded, and the image is adapted automatically to be visible when desktop theme and/or colors change. This property only affects MacOSX.
Since:
1.6
See Also: