3

I need to change the tray icon, so that it would notify users about the number of unread messages.

How to do this with Java?

Rumplin
  • 2,703
  • 21
  • 45
Mediator
  • 14,951
  • 35
  • 113
  • 191

3 Answers3

4

Take a look at the SystemTray class.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
3

If you are using java 6 then his article covers what you need I believe.

http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/

It has a simple example file that shows how to set the sytemtray icon. It also covers some of the usueful methods.

Specifically TrayIcon.setImage()

Kevin D
  • 3,564
  • 1
  • 21
  • 38
1

For versions of Java earlier than 6, I've used JTray, a commercial library. It's OK. Pretty similar to the Java 6 class.

Mike Clark
  • 10,027
  • 3
  • 40
  • 54