JDK-6442221 : No changes accepted in menu items layout
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-06-22
  • Updated: 2011-01-19
  • Resolved: 2007-04-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 7
7Resolved
Related Reports
Duplicate :  
Description
J2SE Version (please include all output from java -version flag):
  java version "1.6.0-beta2"
  Java(TM) SE Runtime Environment (build 1.6.0-beta2-b82)
  Java HotSpot(TM) Client VM (build 1.6.0-beta2-b82, mixed mode, sharing)

Does this problem occur on J2SE 1.4.x or 5.0.x ?  Yes / No (pick one)
  Yes

Operating System Configuration Information (be specific):
  Windows XP Professional SP2


Hardware Configuration Information (be specific):
  Intel Pentium III, 730 Mhz, 384 Mb RAM

Bug Description:
  The layout of popup menu items does not change applying
  setLayout(), setHorizontalAlignment() or pack() .

Steps to Reproduce (be specific):

  Compile and run the attached program. Note that the label
  in the menu items is centered even if statements 1, 2, and
  3 have been executed. All of them seem to be ineffective.

Comments
EVALUATION Swing menu items don't use a layout manager to lay out components. Menu items do it themselves. So JMenuItem.setLayout() doesn't affect anything. However, you can set a layout manager for a menu. Really, there is a problem with JMenuItem.setHorizontalAlignment(). Now the horizontal alignment always should be LEADING, otherwise menu item components can be laid out in a wrong way. It will be fixed in the bounds of a fix for 6458123. A fix for 6458123 is almost done and I believe it will be integrated into 6u4. So I close this bug as a duplicate of 6458123.
18-04-2007

EVALUATION At least we should clearly document this
27-06-2006