JDK-6827786 : Mnemonic cycling for multiple equal mnemonic armed menu items stops when encountering a submenu
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u7,6u12,6u15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux_ubuntu
  • CPU: generic,x86
  • Submitted: 2009-04-08
  • Updated: 2011-03-14
  • Resolved: 2009-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u16-revFixed 7 b74Fixed
Related Reports
Duplicate :  
Relates :  
We have seen an unexpected behavior with a Swing GUI.

When there are multiple menu items with the same mnemonic, the user can press the mnemonic key repeatedly to cycle through these items. However, if one of those items is a submenu, once that menu becomes armed, the cycling stops - pressing the mnemonic key again does not move to the next command. This breaks accessibility of software, as users cannot use mnemnoics to access menu items below the submenu.

The issue is OS independent, it occurs on Windows, Linux, Solaris and even Mac OS X.
The customer uses Java 6u7, but it is also reproducible with Java 6u12 and 5u18 for example.

A testcase is available, it is attached to this report (MenuDemo.tar).

Extract the tarball and simply run

$ java -cp . MenuDemo
(the bytecode has been complied with JDK 5u18, source code is in the same folder)

Click on one of the menus and press "j" repeatedly.
In the first menu, the armed item cycles. In the second menu it gets stuck on the submenu.

EVALUATION It seems a key press gets processed twice. First, BasicMenuKeyListener.menuKeyPressed() properly selects the next item with the corresponding mnemonic. Second, BasicMenuUI.Handler.menuKeyTyped() opens a submenu that has that same mnemonic. The code in BasicMenuUI.Handler.menuKeyTyped() duplicates BasicMenuKeyListener.menuKeyTyped() and should be removed.