tags:

views:

271

answers:

1

I'm looking for a push in the right direction. I have a simple chat program, written totally in Java, and am looking for a way to get the Taskbar icons to flash. Preferably in a manner similar to Pidgin, or MSN.

I'm hoping for a platform independent solution, as there are both Linux and Windows users, and preferably totally in Java.

A: 

There is unfortunately no way to do this in the standard Swing API. But you could work around it in several ways:

  • Flash the icon and title of the window (set a timer and change them whenever it fires).
  • Request focus, then immediately make the window invisible; reverse the process at your preferred interval.

Both techniques are demonstrated in this forums.sun.com thread.

Alternatively, instead of flashing, you could display a message in the system tray using TrayIcon.displayMessage(); that may or may not suit you better, but beware that it may not work cross-platform.

Michael Myers