All necessary components to develop system trays are located in the package org.jdesktop.jdic.tray. The class SystemTray can be seen as placeholder for the TrayIcon. This icon will be displayed in the toolbar and also contains the menu (an instance of JPopupMenu), which will be popuped if the user clicks on the icon. In order to create popup menues with Swing, please look here. Such a popup menu can then be added to the system tray by passing the menu instance to the tray icon.
You can also show messages, like outlook or skype:
The usage of system trays must be carefully planed, because many people don't like unused icons in the toolbar. A system tray can be very usefull in order to provide the user most wanted functions of your system.
Does this work platform independent; i.e., does the same code make a system tray icon in windows and also a menu icon on OS X?
ReplyDeleteThank you for pointing this issue. Yes it does. The JDIC distribution provides necessery libraries for each platform. These libs must be attached to the classpath in order to work correctly.
ReplyDeletethanks for the hint agian