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

JMenu mnemonic problem (menu & menu item) still exists on win32

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.3.0
    • client-libs
    • merlin
    • x86
    • windows_95



      Name: krT82822 Date: 02/16/2000


      (ref: 4246725) <<<---

      java version "1.3.0rc1"
      user's comments:
      "Bug 4195800 ,which is closed [as a dupe], problem still exists in 1.3.0rc1 . Please re-open it."
      ------------------

      16 Feb 2000, eval1127@eng -- code from bug # 4246725 follows. As of kestrel-rc1, the problem is seemingly fixed on Solaris, but NOT on win32.

      Under Solaris, pressing ALT-F (usually) just opens the menu (the first menu item is highlighed, but this is normal -- and the fact that this is the "F" item is purely
      coincidental. The action for the menu ITEM is NOT performed).

      Under NT 4.0 SP6a, the action for menu item "Fix It!" is consistently executed as the result of a single ALT-F, and the menu immediately closes.
      So...this problem is still present in kestrel-rc1.

      /*
      Create menu with mnemonic 'F'. In this menu put menuitem with accelerator 'F'.
      When user presses 'Alt-F', action belonged to menuitem with 'F' is done!
      */

      import javax.swing.*;
      import java.awt.event.*;
      public class MenuBug {
              JFrame frame = new JFrame("Buggy!");

              public MenuBug() {
                      JMenuBar menuBar = new JMenuBar();
                      JMenu file = new JMenu("File");
                      file.setMnemonic('F');
                      JMenuItem fixIt = new JMenuItem("Fix It");
                      fixIt.setMnemonic('F');
                      fixIt.addActionListener(new Buggy());
                      JMenuItem exit = new JMenuItem("Exit");
                      file.add(fixIt);
                      file.add(exit);
                      menuBar.add(file);
                      
                      frame.setJMenuBar(menuBar);
                      frame.setSize(100,50);
                      frame.setVisible(true);
                      frame.addWindowListener(new WindowAdapter() {
                                      public void windowClosing(WindowEvent we) {
                                              System.exit(0);
                                      }
                              });
              }
              
              public static void main(String[] argv) {
                      MenuBug bug = new MenuBug();
              }

              class Buggy implements ActionListener {
                      public void actionPerformed(ActionEvent ae) {
                              System.err.println("BUG!!");
                      }
              }
      }



      (Review ID: 101344)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: