Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flashing taskbar using Java (a la pidgin || MSN)

Tags:

java

taskbar

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.

like image 983
VolatileDream Avatar asked Mar 18 '10 20:03

VolatileDream


1 Answers

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.

like image 66
Michael Myers Avatar answered Oct 14 '22 08:10

Michael Myers