(Important! My code has been repackaged and much expanded by another party as Java System Tray Manager. It is available there under the GNU General Public License. This code, more basic, will remain in the public domain. Also, you may want to check out Tamas Bara's SysTray for Java which works on both Windows and KDE. Sweet!)
Contributed by Tal Liron. Download it here. Contains a project file for Visual C++ 6 and binaries. If you use this code in your software (you may do so freely) I would appreciate a friendly acknowledgement and link.
For an in-depth description, see my article that appeared on the cover of the October 1999 issue of JavaWorld, entitled "Enhance your Java application with Java Native Interface (JNI)".
Desktop indicator is a generic term I use for features like the taskbar or tray icons on Windows' desktops. I have implemented a Windows version, but it is possible to simulate the feature on other platforms. In fact, most platforms allow some sort of graphical indication to appear on the desktop.
Desktop indicators are very useful for applications that run in the background and receive events. A flashing indicator can appear when new mail arrives, when a file transfer ends, or when a directory search is complete. Listeners on the indicator receive AWT mouse-click events when the indicator is clicked. Applications can also use the indicator as an entry point: they can remain hidden until the indicator is clicked.
DesktopIndicator works in JDK 1.1 environments and beyond. Tested with JDK 1.1.8 and JDK 1.2.2 on Windows NT4, 95 and 98.
Joshua Allen provided yet another fix.