JDK-6233556 : PIT: Sub-menus added to a popup menu are broken on XToolkit
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_sun
  • CPU: x86
  • Submitted: 2005-02-27
  • Updated: 2006-04-06
  • Resolved: 2005-03-06
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
6 b27Fixed
Related Reports
Duplicate :  
Relates :  
Description
Sub-menus added to a Popup Menu are not shown at the proper location. When clicking a Sub-menu in a popup menu, the menu items added to the sub-menu are shown much away from the popup menu and none of those menuitems are clickable using mouse. This looks pretty ugly and sub-menus are not all usable. This is reproducible only on the following PIT build, on solaris / linux with XToolkit. 

java version "awt.pit-awt-blade-2005-02-22-Tue-int.mustang"
Java(TM) 2 Runtime Environment, Standard Edition (build awt.pit-awt-blade-2005-02-22-Tue-int.mustang)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b24, mixed mode)

Not reproducible with Win32. Not reproducible on Mustang-b25. 

I have attached a sample test. Execute it on Solaris / Linux (XToolkit is the default toolkit now on unix platforms). You will see a textarea. Right click inside the text area. A popup menu would appear. Click on any of the menus available on the popup menu. Click on any of the sub-menus. If you see menuitems being shown much away from the actual menu clicked, then the bug is reproduced. Also try clicking those menuitems. If you don't see any message on the console, then no action event is triggered.

This is a PIT failure and the basic popupmenu feature is broken on XToolkit. XToolkit is the default toolkit now on unix platforms and hence this bug makes the popupmenu unusable on linux and solaris.

###@###.### 2005-2-27 15:50:14 GMT

Comments
SUGGESTED FIX Remove XMenuPeer.getAbsoluteX method *** /tmp/geta12651.c12654 2005-02-28 18:07:45.762336640 +0300 --- XMenuPeer.java 2005-02-28 17:52:06.735090480 +0300 *************** *** 848,866 **** void setViewable(boolean b) { viewable = b; } - - // WARNING: In some cases, menu coordinates stored in XBaseWindow - // field are relative to parent, in some cases they are absolute. - // Below is the heuristic that allows to get the absolute - // coordinates most of the times. Note that it fails to return - // correct value for the menus of the third level. - // Due to some unknown reasons, getAbsoluteY works fine always. - public int getAbsoluteX() { - if (parentMenu != null && !isPosted()) { - return getX() + parentMenu.getAbsoluteX(); - } else { - // F-word - return getX(); - } - } } --- 848,851 ---- ###@###.### 2005-2-28 15:10:01 GMT
28-02-2005

EVALUATION Notice that sub-menus of third level are broken, all other work fine. Thid-level sub-menus are used very rarely in applications. ###@###.### 2005-2-28 15:06:16 GMT The problem seems to be in XMenuPeer.java, getAbsoluteX method. It was added to fix some positioning problem in menus during the fix for 6215419. At that time, menus were behaving very strange - its coordinates were being changed between its states from relative to absolute, and it was causing problems to the calls toGlobal/toLocal inside of menu showing code. As the result, menus of all levels were being shown at wrong coordinates. However, the source of the problem wasn't not identified correctly at that time, and it has been already fixed. Removal of getAbsoluteX method from XMenuPeer fixes this bug. ###@###.### 2005-2-28 15:10:01 GMT
28-02-2005