JDK-6745220 : Accelerator texts not aligned correctly in RTL menus
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-09-05
  • Updated: 2011-02-16
  • Resolved: 2008-09-05
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Any version of Tiger and Mustang

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
The menu accelerators under RTL layout are not aligned correctly.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an application with different menu items and set frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
The accelerator texts are not aligned and many of them are cur by the window itself. See many screenshots of Metal, Windows and third-party LAFs that inherit them at http://weblogs.java.net/blog/kirillcool/archive/2006/02/aligning_menu_i_1.html

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Accelerator texts are aligned
ACTUAL -
Accelerator texts are partlt cut and not aligned

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
As described in https://looks.dev.java.net/issues/show_bug.cgi?id=111 the line

 accOffset = maxValue - acceleratorRect.width;

(613 in Tiger) should be replaced by

 accOffset = menuItem.getComponentOrientation().isLeftToRight()
     ? maxValue - acceleratorRect.width
     : acceleratorRect.width - maxValue;