United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6736649 test/closed/javax/swing/JMenuItem/6458123/ManualBug6458123.java fails on Linux
6736649 : test/closed/javax/swing/JMenuItem/6458123/ManualBug6458123.java fails on Linux

Details
Type:
Bug
Submit Date:
2008-08-13
Status:
Resolved
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2008-10-15
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7

Related Reports
Backport:
Relates:

Sub Tasks

Description
test/closed/javax/swing/JMenuItem/6458123/ManualBug6458123.java fails on Linux

JDK: 7
OS: SuSe Linux v10.3
Window manager: Gnome
DesktopTheme: Synchronicity

Menu item "Radio Button, icon at the center and below text" in "Second RTL" menu under GTK L&F  has a visual defect. See the attached MenuItemBug.png file. Text and check icon don't have a gap. Text isn't aligned to the right with another menu items.

                                    

Comments
SUGGESTED FIX

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

The cause is in MenuItemLayoutHelper class. It uses SwingUtilities.layoutCompoundLabel() to determine label width and to lay out icon and text in the case of the complex layout. The method takes into account the text bearings for layout purposes, however it doesn't for text rectangle width calculation. In the case of the CENTER layout MenuItemLayoutHelper supposes label width is equal to the text rectangle width (without bearings). When it is time to lay out the label, text width turns out too small to do it. layoutCompoundLabel() trims the text, ends it with "..." and uses the trimmed text for layout. It causes the bug.

A solution is simple. We should take into account the text bearings when we use layoutCompoundLabel() to determine the label width.
                                     
2008-08-14



Hardware and Software, Engineered to Work Together