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

Cricket:Alt+menmonic char not working when menu&menuitem have same mnemonic ch

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.2.1
    • client-libs

    Description

      JDK1.2.1-H build : Alt+menmonic char not working when menu & menuitem have same mnemonic char. This happens only on Windows platforms. Worked fine in JDK1.2.1-G build.

      Steps to simulate the problem,
      1. Run the attached program.
      2. There are 2 menus, 1 - First Menu and 2 - Second Menu. First Menu has menmonics for menuitems also. Second Menu does not have mnemonics set for menuitems
      3. Pressing Alt+1 does not drop down the list of menuitems.
      4. Pressing Alt+2 drops down the list of menuitems.

      --- Sample Code ---
      import java.awt.*;
      import java.util.*;
      import javax.swing.*;
      import java.awt.event.*;
      import javax.swing.border.*;

      public class Bug extends JFrame {
      public Bug() {
      Container content = getContentPane();
      content.setLayout(new BorderLayout());
      content.add("North", createMenuBar("1 - First Menu", true));
      content.add("South", createMenuBar("2 - Second Menu", false));
      pack();
      show();
      }

      public JMenuBar createMenuBar(String str, boolean bFlag) {
      JMenuBar menubar = new JMenuBar();
      JMenuItem menuitem;

      JMenu menu = new JMenu(str);
      menu.setMnemonic(str.charAt(0));

      menubar.add(menu);
      for(int i = 0; i < 10; i ++) {
      menuitem = new JMenuItem("JMenuItem" + i);
      if(bFlag)
      menuitem.setMnemonic('0' + i);
      menu.add(menuitem);
      }
      return menubar;
      }

      public static void main(String argv[]) {
      new Bug();
      }
      }

      --- Sample Code ---

      Attachments

        Issue Links

          Activity

            People

              gsaab Georges Saab
              mmadhugisunw Mukund Madhugiri (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: