Name: sv35042 Date: 10/09/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Bug 4214563 is not fixed or has resurfaced in JDK1.4. Run
the following program. Right-click anywhere on the frame.
Try using cursor keys, enter, or any of the shortcuts.
Nothing works.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the following code.
2. Right-click mouse on the frame to bring up popup
3. Press the cursor keys.
4. Notice that nothing happens
5. Press enter
6. Notice that nothing happens
7. Press the A key
8. Notice that nothing happens
9. Press ALT-A
10. Notices that nothing happens
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expected the cursor keys to chagne the popup selection.
I expected the shortcuts (mnemonics) to work. I expected
Enter and ESC to dismiss the popup.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class PopupBug extends JFrame{
private JPopupMenu popup;
public PopupBug(){
super("Popup");
init();
}
private void init(){
setPopup();
addMouseListener(new MouseAdapter(){
public void mousePressed( MouseEvent e ){
if(e.isPopupTrigger()){
popup.show(getThis(),e.getX(),e.getY());
}
}
public void mouseClicked( MouseEvent e ){
if(e.isPopupTrigger()){
popup.show(getThis(),e.getX(),e.getY());
}
}
public void mouseReleased( MouseEvent e ){
if(e.isPopupTrigger()){
popup.show(getThis(),e.getX(),e.getY());
}
}
});
setSize(400,400);
setLocation(450,200);
setVisible(true);
}
private void setPopup(){
popup = new JPopupMenu();
JMenuItem item;
popup.add(item=new JMenuItem("Confirm"));
item.setMnemonic('C');
popup.add(item=new JMenuItem("Add"));
item.setMnemonic('A');
popup.add(item=new JMenuItem("Delete"));
item.setMnemonic('D');
popup.add(item=new JMenuItem("Print"));
item.setMnemonic('P');
popup.addSeparator();
popup.add(item=new JMenuItem("Quit"));
item.setMnemonic('Q');
}
private JFrame getThis(){return this;}
public static void main(String[] args){
new PopupBug();
}
}
---------- END SOURCE ----------
Release Regression From : 1.3.1
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: 146174)
======================================================================