-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
1.2.2
-
None
-
sparc
-
solaris_1, solaris_2.5.1
> > we have a 'Windows' menu with mnemonic 'W' as well as a menu item 'Window
> > List..' with the same mnemonic.
> > When typing Alt+W the pulldown menubar opens AND the ActionEvent is being
> > fired.
> > Is there any simple answer to that ?
This is reproducible using 1.2fcs and jdk1.2.2-T.
However in 1.3 the ActionEvent is not fired when Alt+E is pressed (expected
result the menu is pulled down), but if you press ALT+E again the ActionEvent
should be fired, but it is not.
Test Case that I used is :-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MenuSample {
static class MenuActionListener implements ActionListener {
public void actionPerformed (ActionEvent e) {
System.out.println ("Selected: " + e.getActionCommand());
}
}
public static void main(String args[]) {
ActionListener menuListener = new MenuActionListener();
JFrame frame = new JFrame("MenuSample Example");
JMenuBar bar = new JMenuBar();
JMenu file = new JMenu("File");
file.setMnemonic('F');
bar.add(file);
JMenuItem closeItem = new JMenuItem("Close");
closeItem.setMnemonic('C');
closeItem.addActionListener(menuListener);
file.add(closeItem);
JMenu edit = new JMenu("Edit");
edit.setMnemonic('E');
bar.add(edit);
JMenuItem cutItem = new JMenuItem("Cut");
cutItem.setMnemonic('C');
cutItem.addActionListener(menuListener);
edit.add(cutItem);
JMenuItem editItem = new JMenuItem("Editlist");
editItem.setMnemonic('E');
editItem.addActionListener(menuListener);
edit.add(editItem);
frame.setJMenuBar(bar);
frame.setSize(350, 250);
frame.setVisible(true);
}
}
adele.carrie@ireland 1999-07-02
> > List..' with the same mnemonic.
> > When typing Alt+W the pulldown menubar opens AND the ActionEvent is being
> > fired.
> > Is there any simple answer to that ?
This is reproducible using 1.2fcs and jdk1.2.2-T.
However in 1.3 the ActionEvent is not fired when Alt+E is pressed (expected
result the menu is pulled down), but if you press ALT+E again the ActionEvent
should be fired, but it is not.
Test Case that I used is :-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MenuSample {
static class MenuActionListener implements ActionListener {
public void actionPerformed (ActionEvent e) {
System.out.println ("Selected: " + e.getActionCommand());
}
}
public static void main(String args[]) {
ActionListener menuListener = new MenuActionListener();
JFrame frame = new JFrame("MenuSample Example");
JMenuBar bar = new JMenuBar();
JMenu file = new JMenu("File");
file.setMnemonic('F');
bar.add(file);
JMenuItem closeItem = new JMenuItem("Close");
closeItem.setMnemonic('C');
closeItem.addActionListener(menuListener);
file.add(closeItem);
JMenu edit = new JMenu("Edit");
edit.setMnemonic('E');
bar.add(edit);
JMenuItem cutItem = new JMenuItem("Cut");
cutItem.setMnemonic('C');
cutItem.addActionListener(menuListener);
edit.add(cutItem);
JMenuItem editItem = new JMenuItem("Editlist");
editItem.setMnemonic('E');
editItem.addActionListener(menuListener);
edit.add(editItem);
frame.setJMenuBar(bar);
frame.setSize(350, 250);
frame.setVisible(true);
}
}
adele.carrie@ireland 1999-07-02
- duplicates
-
JDK-4251614 Multiple usage of same mnemonic in menu leads to unexpected effects
-
- Closed
-
-
JDK-4246725 JMenu and JMenuItem with same mnemonic still broken
-
- Closed
-