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

REGRESSION:Menu mnemonics don't work properly when submenu is first item in menu

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.1
    • client-libs



      Name: rmT116609 Date: 10/23/2002


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


      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      This was tested with and without "Hide keyboard navigation
      indicators until I use the Alt key" checked.

      A DESCRIPTION OF THE PROBLEM :
      If a menu in the menu bar has a submenu as its first item,
      then keypresses will activate items in the submenu, not the
      outer menu.

      REGRESSION. Last worked in version 1.4

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run the attached program.
      2. Press Alt-M, then press E.
      3. Press Alt-M, then press C.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      When Alt-M then E is pressed, the "Exit" command is fired.
      When Alt-M then C is pressed, the "Choice" command is fired.

      Actual:
      When Alt-M then E is pressed, the "Other choice" command is
      fired.
      When Alt-M then C is pressed, the menu remains open and
      nothing is fired.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class MenuRegression2 extends JFrame implements ActionListener
      {
        public static void maien (String[] args)
        {
          new MenuRegression2();
        }

        public MenuRegression2()
        {
          super();

          WindowListener l = new WindowAdapter()
          {
            public void windowClosing(WindowEvent e) {System.exit(0);}
          };
          addWindowListener (l);

          setTitle ("Menu testing");

          JMenuBar t_menuBar = new JMenuBar();
          setJMenuBar(t_menuBar);
          JMenu menu1 = new JMenu("Menu");
          menu1.setMnemonic('M');
          t_menuBar.add(menu1);

          JMenu menu2 = new JMenu("Submenu");
          menu2.setMnemonic('B');
          menu1.add(menu2);

          JMenuItem menuItem = new JMenuItem("Other choice");
          menuItem.setMnemonic('E');
          menuItem.addActionListener(this);
          menu2.add(menuItem);

          menuItem = new JMenuItem("Choice");
          menuItem.setMnemonic('C');
          menuItem.addActionListener(this);
          menu1.add(menuItem);

          menuItem = new JMenuItem("Exit");
          menuItem.setMnemonic('E');
          menuItem.addActionListener(this);
          menu1.add(menuItem);

          pack();
          show();
        }

        public void actionPerformed (ActionEvent A)
        {
          System.out.println ("Action performed on " + A.getActionCommand());
        }
      }

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

      Release Regression From : 1.4.0_02
      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: 166146)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: