Name: rmT116609 Date: 10/14/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
This was tested both with and without "Hide keyboard
navigation until I use the Alt key" checked.
A DESCRIPTION OF THE PROBLEM :
If a submenu has the same mnemonic as an item in that
submenu, then pressing that letter to activate the submenu
will activate the menu item too. This makes it impossible
to browse that submenu using mnemonics.
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the following program and run it.
2. Press Alt-A.
3. Press B.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: When Alt-A is pressed, menu A opens. When B is
pressed, submenu B1 opens.
Actual: When Alt-A is pressed, menu A opens. When B is
pressed, menu item B2 (under B1) immediately fires. This
is demonstrated by the menus closing and a line being
printed to the console.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class MenuRegression extends JFrame
implements ActionListener
{
public static void main (String[] args)
{
new MenuRegression();
}
public MenuRegression ()
{
super();
WindowListener l = new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
};
addWindowListener (l);
setTitle ("Menu testing");
JMenuBar t_menuBar = new JMenuBar();
setJMenuBar(t_menuBar);
JMenu menu1 = new JMenu("A");
menu1.setMnemonic('A');
t_menuBar.add(menu1);
JMenu menu2 = new JMenu("B1");
menu2.setMnemonic('B');
menu1.add(menu2);
JMenuItem menuItem = new JMenuItem("B2");
menuItem.setMnemonic('B');
menu2.add(menuItem);
menuItem.addActionListener(this);
pack();
show();
}
public void actionPerformed (ActionEvent A)
{
System.out.println ("Action performed on " + A.getActionCommand());
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.0_02
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 165769)
======================================================================