Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4729669

1.4 REGRESSION: Text edge of different types of JMenuItems are not aligned

XMLWordPrintable

    • beta
    • generic, x86, sparc
    • generic, solaris_2.5.1, solaris_2.6, windows_nt, windows_xp

      Name: jk109818 Date: 08/09/2002


      FULL PRODUCT VERSION :
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Windows NT Version 4.0
      (SP 4)

      A DESCRIPTION OF THE PROBLEM :
      The beginning edge of the text in JMenuItems (left edge in
      English) does not line up with the text edge of
      JRadioButtonMenuItems and JCheckBoxMenuItems. Specifically:

      In the Metal and Motif look and feels, JRadioButtonMenuItems
      and JCheckBoxMenuItems line up with each other, but not with
      plain JMenuItems. Real Motif menus line up all text edges
      in a menu.

      In the Windows look and feel, JCheckBoxMenuItems and
      JMenuItems line up with each other, but
      JRadioButtonMenuItems do not line up with them. This is a
      regression from JDK 1.3.1.

      All of the above appearance bugs are also in JDK 1.4.0.

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a JMenu (or JPopupMenu) with some JCheckBoxMenuItems,
      some JRadioButtonMenuItems, and some plain JMenuItems.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The leading edges of the text of all items in a JMenu should
      be aligned horizontally; that is, all menu item text should
      start at the same x-coordinate.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // This does not take any steps to change the Swing look and feel, but that
      // can be done with the swing.defaultlaf system property.

      import java.awt.*;
      import javax.swing.*;

      public class MenuItemTest
      {
          public static void main(String[] args)
          {
              JMenu menu = new JMenu("View");
              menu.setMnemonic('V');

              menu.add(new JMenuItem("Refresh"));
              menu.add(new JMenuItem("Customize..."));
              menu.add(new JCheckBoxMenuItem("Show Toolbar"));
              menu.addSeparator();
              menu.add(new JRadioButtonMenuItem("List"));
              menu.add(new JRadioButtonMenuItem("Icons"));

              JFrame frame = new JFrame("Menu Item Test");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              JMenuBar menuBar = new JMenuBar();
              menuBar.add(menu);
              frame.setJMenuBar(menuBar);

              frame.setSize(300, 300);
              frame.show();
          }
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.3.1
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 160601)
      ======================================================================
      ###@###.### 10/9/04 13:18 GMT

            kizune Alexander Zuev
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: