Search code examples
javaswingsystray

Make the java systray look prettier in Linux


I'm making a Java Application on Linux that uses sytray using Java 6 and Swing. The app looks great (uses the system look and feel) but the systray looks awful. I mean the systray menu looks like old widgedts (Motif?). I wonder if there is a way to set a look and feel or something to make the system tray prettier.

Heres a screenshot of the tray: enter image description here


Solution

  • Have you tried JXTrayIcon?

    I tested this demo from SwingHelper on Ubuntu 10.10 with Compiz and it looks cool.

    UPDATE

    As 2020, these links are broken and this solution has many drawbacks today. For instance, GNOME3 desktop environments had removed entirely system tray icons and they replaced it with AppIndicator.

    Java's (AWT/Swing) System Tray support is broken today. I recommend using this Java library: https://github.com/dorkbox/SystemTray

    From the site:

    Professional, cross-platform SystemTray support for Swing/AWT, GtkStatusIcon, and AppIndicator on Java 6+. This library provides OS Native menus and Swing/AWT menus, depending on the OS and Desktop Environment and if AutoDetect (the default) is enabled.

    For reference, you can found a copy of the original example at here