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

Support duplicate mnemonics in menus

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4.1
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      generic, x86
    • OS:
      generic, windows_2000
    • Verification:
      Verified

      Description

      If two menu iteams in the same menu have the same mnemonic, the second item is not accessible.

      Of course, it is best to design a menu so that there are no duplicate mnemonics. Sometimes this is very difficult, though, and it would be nice to have some flexibility.

      The Forte for Java IDE is extensible and can have many different configurations. Different components add menu items and assign mnemonics. Because of this, it is simply unavoidable that sometimes mnemonics get duplicated. The IDE also make extensive use of contextual menus. These are so dynamic that mnemonics have to be avoided altogether because duplicates would occur very frequently.

      JMenu would have to change a bit to support duplicate mnemonics. We propose that the behavior for unique mnemonics should not be affected. The behavior should only change when there are duplicates. In this case only, the item would be highlighted when the mnemonic is pressed. A second press of the mnemonic key would move to the second item, and so on. Return would be required to actually execute the command.

      Other solutions may be possible as well.

      Name: jl125535 Date: 11/30/2001


      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      When a JMenu contains two items with the same mnemonic, the
      behavior of the JMenu is inconsistent with the standard behavior
      for Microsoft Windows. In Windows, when the user types a
      duplicated mnemonic, the system does two things differently:
      First, it jumps to the next menu item with the chosen mnemonic,
      wrapping to the top if needed. Second, it selects the menu item
      but doesn't activate it. This lets the user type the mnemonic
      again, to cycle through the menu items.

      JMenu simply picks the first JMenuItem it finds with that
      mnemonic and activates it.

      The behavior in Windows is better. Swing's menus, under the
      Windows L&F, should be changed to conform to Windows for two
      reasons:

      1) It should be consistent with the native platform's conventions.
      2) It's a better way to handle the mnemonics.

      This is covered by RFE 4515762, but failure to duplicate the
      Windows L&F should be considered a bug, not an RFE. But it's
      actually a good idea under the Metal L&F as well, for the reason
      given in RFE 4515762. I'm tired of avoiding the obvious
      mnemonics for a menu item, because they conflict with other obvious
      mnemonics. I'm tired of explaining to users why I don't give them
      better mnemonics.
      (Review ID: 136481)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mdavidsosunw Mark Davidson (Inactive)
                Reporter:
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: