JDK-6448876 : Systray Icon not shown in KDE using Mustang
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-07-14
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u4Fixed 7 b02Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b90)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b90, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux Golgotha 2.6.17-ARCH #1 SMP PREEMPT Tue Jun 20 12:31:51 CEST 2006 i686 Intel(R) Pentium(R) M processor 1.60GHz GenuineIntel GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
KDE version 3.5.3

A DESCRIPTION OF THE PROBLEM :
I played around with the new systray feature in Mustang and realized that the icon will not appear in the tray area of KDE. I tried the same program under Windows and Gnome with success. Only KDE has problems displaying the icon.
When I start the program the space for the tray icon appears in KDEs Tray but it's empty. The popup menu is also not shown when clicking on the empty space with right mouse button.
I realized one time that the icon moved from up to down like pictures scrolling through a screen but I could not reproduce that again.
Earlier I tried also Mustang BETA 1 with the same result.
I will attach the code I'm using. Keep in mind that javacup.gif which is used by the code is missing but you can take other images as well. For simplicity you can simply take http://chat.ananzi.co.za/javacup.gif which should be the same except of the size maybe.


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 ----------

Comments
SUGGESTED FIX The webrev: http://javaweb.sfbay/jcg/1.7.0-dolphin/awt/6448876
31-07-2006

EVALUATION The problem is in the workaround used to center the icon window on Gnome desktop. It breaks the behaviour (sets wrong position) on KDE.
21-07-2006

EVALUATION It seems that this bug is specific to KDE 3.5.3 as the submitter confirmed that with 3.5.1 no problems appear.
19-07-2006

EVALUATION On KDE 3.5.1 the test also works fine and a tray icon appears.
18-07-2006

EVALUATION The bug is not reproducible with KDE 3.3.x, as there is no KDE 3.5.3 here I can't run the test with it.
14-07-2006