The system tray is located in the Windows Taskbar, usually at the bottom right corner next to the clock. It contains miniature icons for easy access to system functions such as antivirus settings, printer, modem, sound volume, battery status, and more. Double-click or right-click an icon to view and access the details and controls. The system tray was first introduced with Microsoft Windows 95, and is now used in Windows 98, 98SE, Me, NT 4.0, 2000, and XP.

Since Java 1.5 does not have an api allowing you add icons to the system tray, you need to use a third party library which uses JNI (Java Native Interface) to be able to implement this functionality.

JDIC (JDesktop Integration Components) allows creation of a tray icon on the desktop (in the System Tray Area for Windows platforms, or in the Notification Area for Unix platforms), with a caption (text), an animated icon, and an associated Swing menu containing icons. It can also display a tooltip when the mouse hovers over the tray icon.

Following example shows how to implement such a functionality. You may look at JDIC documentation for further details.

 import java.awt.event.*;
import javax.swing.*;
import org.jdesktop.jdic.tray.*;

public class TestTray {
    public static JMenuItem quit;
    public TestTray() {
        JPopupMenu menu = new JPopupMenu("Tray Icon Menu");
        menu.add(new JMenuItem("Test Item"));
        JMenuItem quitItem = new JMenuItem("Quit");
        quitItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
        // Resource file "duke.gif" must exist at the same directory
        // as this class file.
        ImageIcon icon = new ImageIcon("duke.gif");
        TrayIcon ti = new TrayIcon(icon, "JDIC Tray Icon API Test", menu);

        // Action listener for left click.
        ti.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                    "JDIC Tray Icon API Test!", "About",
        SystemTray tray = SystemTray.getDefaultSystemTray();

    public static void main(String[] args) {
        new TestTray();