views:

96

answers:

2

How to/What is a good library, to create a fading indicator message in Java like that of Outlook when you get a message, or Ubuntu/Gnome when you've connected to a network?

+3  A: 

I would use Trident animation library. Your task would be almost trivial if you use it.

Also you could take a look at Timing Framework, but it wasn't updated for a long time.

eugener
+3  A: 

Java 1.6 has a TrayIcon class that can be used to display notification messages.

SystemTray tray = SystemTray.getSystemTray();
Image image = Toolkit.getDefaultToolkit().getImage("tray.gif");
TrayIcon trayIcon = new TrayIcon(image, "Tray Demo");
tray.add(trayIcon);
trayIcon.displayMessage("Hello, World", "notification demo", MessageType.INFO);

Here's the result:
TrayIcon on Windows TrayIcon on Linux

On Linux you may also have a little program called notify-send. It makes it easy to invokes the standard freedesktop.org notification system from the shell. You can also run it from Java.

String[] notifyCmd = {"notify-send", "Hello, World!"};
Runtime.getRuntime().exec(notifyCmd);

I had to apt-get install libnotify-bin to get this on my Ubuntu box.

notify-send


I've tested these things on Windows 7 and Ubuntu 9.10. In each case the notification disappeared after some time which is I suppose the fading indicator effect that you want.

Alexandre Jasmin