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

Mnemonic on JMenu doesn't work if mnemonic character requires SHIFT modifier

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.2
    • client-libs
    • beta
    • x86
    • windows_nt



      Name: skT88420 Date: 10/12/99


      The problem can be observed by running the code below. It presents a small JFrame containing a menubar with two menus on it - "File" and "What?". The mnemonic for the first menu is 'F' and for the second menu is '?'. Alt-F successfully invokes the File menu, but neither Alt-Shift-? or Alt-? will invoke the What? menu.

      This is a problem for us in the French version of our product. Apparently it is common to label help menus in French apps with a single '?' character.


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

      class TestFrame
      extends JFrame
      {
      public TestFrame()
      {
      setSize(100, 100);
      JPanel topPanel = new JPanel();
      topPanel.setLayout(new BorderLayout());
      getContentPane().add(topPanel);
      JMenuBar menuBar = new JMenuBar();
      setJMenuBar( menuBar );

      JMenu file = new JMenu("File");
      file.setMnemonic('F');
      file.add(new JButton("New"));

      JMenu help = new JMenu("What?");
      help.setMnemonic('?');
      help.add(new JButton("Index"));

      menuBar.add(file);
      menuBar.add(help);
      }

      public static void main(String args[])
      {
      TestFrame mainFrame = new TestFrame();
      mainFrame.setVisible(true);
      }
      }
      (Review ID: 96402)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: