Duplicate :
|
FULL PRODUCT VERSION : java version "1.6.0" Java(TM) SE Runtime Environment (build 1.6.0-b105) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux kopernikus 2.6.21-rc1-default #1 SMP Sun Feb 25 20:35:30 CET 2007 x86_64 x86_64 x86_64 GNU/Linux EXTRA RELEVANT SYSTEM CONFIGURATION : Xfce 4.4 A DESCRIPTION OF THE PROBLEM : SystemTray.isSupported() returns false with Xfce 4.4. Xfce supports the freedesktop.org system tray implementation. I never had problems with both Gtk/Gnome and KDE applications. Also the generic system tray support of Qt 4.2 works just flawlessly. Althought only GNOME is supported by Sun, why not simply implementing the standard that works on all desktops? That's why freedesktop.org exists! STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : I used the test program of bug 6448876. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - SystemTray.isSupported() should return true ACTUAL - SystemTray.isSupported() returns false ERROR MESSAGES/STACK TRACES THAT OCCUR : No error messages REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.AWTException; import java.awt.Image; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /* * Created on May 19, 2006 */ public class Systray { /** * @param args */ public static void main(String[] args) { Image image = Toolkit.getDefaultToolkit().getImage("images/javacup.gif"); TrayIcon trayIcon = null; if (SystemTray.isSupported()) { // get the SystemTray instance SystemTray tray = SystemTray.getSystemTray(); // create a action listener to listen for default action executed on the tray icon ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { } }; // create a popup menu PopupMenu popup = new PopupMenu(); // create menu item for the default action MenuItem defaultItem = new MenuItem("test entry"); defaultItem.addActionListener(listener); popup.add(defaultItem); /// ... add other items // construct a TrayIcon trayIcon = new TrayIcon(image, "Tray Demo", popup); trayIcon.setImageAutoSize(true); // set the TrayIcon properties trayIcon.addActionListener(listener); // ... // add the tray image try { tray.add(trayIcon); } catch (AWTException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // ... } else { // disable tray option in your application or // perform other actions } // ... // some time later // the application state has changed - update the image if (trayIcon != null) { trayIcon.setImage(image); } // ... } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Unfortunately, there's no workaround. :(