JDK-5087210 : Key operations stop working on AWT menu after certain operations
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-08-16
  • Updated: 2004-08-16
  • Resolved: 2004-08-16
Related Reports
Duplicate :  
Relates :  
Description
Name: dk106046			Date: 08/16/2004

OPERATING SYSTEM(S):
Linux (RH8.0, RHEL3/0, SLES8)

FULL JDK VERSION(S):
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)


1. Build testcase: javac Test.java

import java.awt.*;
import java.awt.event.*;

public class Test extends Frame implements ActionListener{
    Menu	m, sm;
    Label l1,l2;
    
    Test(){	
	super("Test");
	setLayout(new GridLayout(2,1));
	
	m = new Menu("menu",true);
	
	for(int i=0 ; i<3 ; i++){
	    MenuItem mi = new MenuItem("item "+i);
	    mi.addActionListener(this);
	    m.add(mi);
	}
	
	sm = new Menu("submenu");
	
	for(int i=0 ; i<3 ; i++){
	    MenuItem mi = new MenuItem("sub item "+i);
	    mi.addActionListener(this);
	    sm.add(mi);
	}
	
	m.add(sm);
	
	MenuBar mb = new MenuBar();
	mb.add(m);
	setMenuBar(mb);
	
	Panel p = new Panel();
	p.setLayout(new GridLayout(1,2));
	l1 = new Label("Selected Menu Item:");
	l2 = new Label("Nothing");
	p.add(l1);
	p.add(l2);
	add(p);
	
	Button Quit = new Button("Quit");
	Quit.addActionListener(this);
	add(Quit);
	
	setSize(500, 300);
	setVisible(true);
    }
    
    public void actionPerformed(ActionEvent e){
	String cmd = e.getActionCommand();
	
	if(cmd == "Quit"){
	    System.exit(0);
	}else{
	    l2.setText(cmd);
	}
    }
    public static void main(String[] args){
	Test t=new Test();
    }
}


2. Run testcase:     java Test

3. Click the menu to post its popup.

4. Click the "submenu" menu item so the sub menu is posted

5. Click the "submenu" menu item one more time so the submenu is hidden

6. After these operations,the Enter key or RightArrow key does not work for 
the "submenu" menu item (ie, cannot post it's popup using the keyboard). <-------- PROBLEM!!

======================================================================

Comments
EVALUATION Looks like a duplicate of 5087204 (Key operations stop working on AWT menu after certain operations) ###@###.### 2004-08-16 Name: df153228 Date: 08/16/2004 The bug is very similar to the bug number 5087097. The behavior is reproducible on solaris-sparc on jdk1.4.2 and jdk1.5.0b60 ###@###.### ======================================================================
17-08-2004

WORK AROUND Name: dk106046 Date: 08/16/2004 Use the mouse instead. ======================================================================
17-08-2004