United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4310333 API to add a java program to a system's app-launching panel/toolbar
JDK-4310333 : API to add a java program to a system's app-launching panel/toolbar

Submit Date:
Updated Date:
Project Name:
Resolved Date:
Affected Versions:
Fixed Versions:

Related Reports

Sub Tasks


Name: krT82822			Date: 02/05/2000

java version "1.2"
Classic VM (build JDK-1.2-V, native threads)

Some Desktops (KDE, MS Windows) have panels/toolbars providing fast access to programs. Some
programs can dock into these panels, to add functionality to the user's basic configuration. An example is the ICQ-Client.

Java should allow the possibility of adding an icon to such a panel,  and providing access to the
functionality the icon provides/represents.

If the platform does not have such a panel/toolbar, the API methods should throw an

If the Java API contains such a functionality, it would be possible to write
applications in Java, that can dock to the panel :-)
(Review ID: 100731) 



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
extends java.lang.Object

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()
	TrayIcon[] 	getTrayIcons()
	Dimension 	getTrayIconSize()
static 	boolean 	isSupported()
	void	 	remove(TrayIcon trayIcon)

public class TrayIcon
extends java.lang.Object

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 	addMouseMotionListener(java.awt.event.MouseMotionListener
void 	displayMessage(java.lang.String caption, java.lang.String text,
                       TrayIcon.MessageType messageType)
String 	getActionCommand()
ActionListener[]	getActionListeners()
Image 	getImage()
MouseListener[] 	getMouseListeners()
MouseMotionListener[] 	getMouseMotionListeners()
PopupMenu	 	getPopupMenu()
Dimension 		getSize()
String 	getToolTip()
boolean	isImageAutoSize()
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

Hardware and Software, Engineered to Work Together