Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4248642
Votes 0
Synopsis Cricket:Alt+menmonic char not working when menu&menuitem have same mnemonic ch
Category java:classes_swing
Reported Against 1.2.1
Release Fixed
State 11-Closed, duplicate of 4213634, bug
Priority: 3-Medium
Related Bugs 4213634
Submit Date 22-JUN-1999
Description
JDK1.2.1-H build : Alt+menmonic char not working when menu & menuitem have same mnemonic char. This happens only on Windows platforms. Worked fine in JDK1.2.1-G build.

Steps to simulate the problem,
1. Run the attached program.
2. There are 2 menus, 1 - First Menu and 2 - Second Menu. First Menu has menmonics for menuitems also. Second Menu does not have mnemonics set for menuitems
3. Pressing Alt+1 does not drop down the list of menuitems.
4. Pressing Alt+2 drops down the list of menuitems.

--- Sample Code ---
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

public class Bug extends JFrame {
	public Bug() {
		Container content = getContentPane();
		content.setLayout(new BorderLayout());
		content.add("North", createMenuBar("1 - First Menu", true));
		content.add("South", createMenuBar("2 - Second Menu", false));
		pack();
		show();
	}
	
	public JMenuBar createMenuBar(String str, boolean bFlag) {
		JMenuBar menubar = new JMenuBar();
		JMenuItem menuitem;
		
		JMenu menu = new JMenu(str);
		menu.setMnemonic(str.charAt(0));
		
		menubar.add(menu);
		for(int i = 0; i < 10; i ++) {
			menuitem = new JMenuItem("JMenuItem" + i);
			if(bFlag)
				menuitem.setMnemonic('0' + i);
			menu.add(menuitem);
		}
		return menubar;
	}

	public static void main(String argv[]) {
		new Bug();
	}
}

--- Sample Code ---
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang