JDK-6584657 : GTK Look and Feel: Bugs in menu item layout
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-07-24
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
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 Other
6u23Fixed 7 b38Fixed OpenJDK6Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
There is a fix for 6458123 CR: Bugs in menu item layout. It fixes menu item bugs for several L&Fs, but doesn't for GTK L&F. This CR is targeted to solve menu item problems under GTK L&F.

There are the following problems in GTK L&F (a test case and screen shots are in the attachment):
1. Menu item width is too small when a top-level item has an icon. (bug_1.png)
2. Horizontal text position and vertical text position are not processed correctly. (bug_2.png)
3. Horizontal alignment and vertical alignment are not processed correctly. (bug_3.png)

Testing strategy:
1. Run the GTKMenuItems.main()
2. Select the GTK L&F with a radio button
3. Try to open each drop-down menu to see the problems
Copied from the description of a duplicate CR 6687241:

Platform: Solaris 11, Redhat Linux 5
locale: Arabic and Hebrew
build: 6u10 b21.

This problem exists since 1.4.2_17.

To reproduce the bug:
Choose Solaris or Redhat Linux platform.
1. Install jdk6u10 b21
2. Install test tools GS-Tonga_12.zip
3.Set test environment
4. run runnit.sh script: sh runnit.sh -keywords:"ar&&manual"
5. Follow to JMenuItemTest.  Change LAF to GTK+ from LookAndFeel menu.  Click "TestMenu".  Then focus mouse to "Radio Button Menu Item"  of right-to-left menuitem.
6.  Note  "Alt-1" , the word has been truncated.

Or compiled and run the application separately:  i18n_mustang_ws\i18n\src\GS-Manual\ComponentOrientationTest\JMenuItemTest.java
I have compiled and archived it as JMenuItemTest.jar in attachment.  Execute "$JAVA_HOME/bin/java -jar JMenuItemTest.jar"  to reproduce the bug:
1. Execute "$JAVA_HOME/bin/java -jar JMenuItemTest.jar"
2. Change LAF to GTK+ from LookAndFeel menu.  Click "TestMenu".  Then focus mouse to "Radio Button Menu Item"  of right-to-left menuitem.
3.  Note  "Alt-1" , the word has been truncated.

src.zip file is source code of JMenuItemTest.jar in attachemt.
*** (#1 of 2): 2008-04-11 10:57:56 MSD ###@###.###

I can reproduce this in any locale. So, it's not specific to Arabic/Hebrew. But it looks like related to rendering or layout related to right-to-left component-orientation and/or gtk, shown by the following part of the code:

  menu.add(menuItem);
        menuItem = new JRadioButtonMenuItem("Radio Button Menu Item");
        menuItem.setComponentOrientation(o);
        menuItem.setSelected(true);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1,
                                                       ActionEvent.ALT_MASK));
Also, the RadioButton looks like a checkbox in this test case in all 3 look and feels.
*** (#2 of 2): 2008-04-11 20:45:21 MSD ###@###.###

Comments
SUGGESTED FIX The approved webrev revision was copied to NFS: /net/sa.sfbay/export/home/swing/data/7/6584657.6 URL: http://sa.sfbay.sun.com/projects/swing_data/7/6584657.6
08-08-2008

EVALUATION The problems can be fixed exactly as in the fix for 6458123 because SynthMenuItemUI is almost the same as BasicMenuItemUI.
24-07-2007