Fix in Tiger
Fixed in mustang.
###@###.### 2005-04-29 14:24:01 GMT
The new feature provides the following two classes in java.awt package:
public class SystemTray
The SystemTray class represents the system tray for a desktop. On Microsoft Windows it is referred to as the "Taskbar Status Area", on Gnome it is referred to as the "Notification Area", on KDE it is referred to as the "System Tray". The system tray is shared by all applications running on the desktop.
On some platforms the system tray may not be present or may not be supported, in this case getSystemTray() throws UnsupportedOperationException. To detect whether the system tray is supported, use isSupported().
The SystemTray may contain one or more TrayIcons, which are added to the tray using the add(TrayIcon) method, and removed when no longer needed, using the remove(TrayIcon). TrayIcon consists of an image, a popup menu and a set of associated listeners. Please see the TrayIcon class for details.
Every Java application has a single SystemTray instance that allows the app to interface with the system tray of the desktop while the app is running. The SystemTray instance can be obtained from the getSystemTray() method. An application may not create its own instance of SystemTray.
Here's the methods:
void add(TrayIcon trayIcon)
static SystemTray getSystemTray()
static boolean isSupported()
void remove(TrayIcon trayIcon)
public class TrayIcon
A 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 ComponentEvent.getComponent()) The source property will be set to this TrayIcon. (See EventObject.getSource())
Note: the actions which show a popup menu and select a tray icon are associated with different user gestures.
A TrayIcon can generate an ActionEvent. On some platforms, this occurs when the user selects the tray icon using either the mouse or keyboard.
Here's the methods:
void addActionListener(java.awt.event.ActionListener listener)
void addMouseListener(java.awt.event.MouseListener listener)
void displayMessage(java.lang.String caption, java.lang.String text,
void removeActionListener(java.awt.event.ActionListener listener)
void removeMouseListener(java.awt.event.MouseListener listener)
void removeMouseMotionListener(java.awt.event.MouseMotionListener listener)
void setActionCommand(java.lang.String command)
void setImage(java.awt.Image image)
void setImageAutoSize(boolean autosize)
void setPopupMenu(java.awt.PopupMenu popup)
void setToolTip(java.lang.String tooltip)
###@###.### 2005-05-03 13:36:15 GMT