-
Bug
-
Resolution: Fixed
-
P3
-
6
-
None
-
b47
-
generic
-
solaris
-
Verified
Popup menu is shown and hidden immediately when invoked by right mouse button click.
Compile and execute test below.
Right-click on text area.
Most likely popup menu will blink and hide.
Left click on button.
Popup menu is shown normally and can be navigated using mouse and keyboard.
import java.awt.*;
import java.awt.event.*;
public class PopupMenuTest {
static final Button button = new Button("Click Me");
public static void main(String args[]) throws Exception {
final PopupMenu popup = new PopupMenu();
for(int i=0; i<10; i++) {
Menu menu = new Menu("Main Menu " + i);
for(int j=0; j<10; j++) {
MenuItem menuItem = new MenuItem("MenuItem " + j);
menu.add(menuItem);
}
popup.add(menu);
}
Frame frame = new Frame();
frame.setLayout(new BorderLayout(5, 5));
TextArea label = new TextArea("Text Area");
frame.add(label);
frame.add(button, BorderLayout.SOUTH);
label.addMouseListener(new MouseAdapter() {
public void mousePressed( MouseEvent me ) {
if(me.isPopupTrigger()) {
popup.show(me.getComponent(), me.getX(), me.getY());
}
}
public void mouseReleased( MouseEvent me ) {
if(me.isPopupTrigger()) {
popup.show(me.getComponent(), me.getX(), me.getY());
}
}
});
button.addActionListener(new ActionListener() {
public void actionPerformed( ActionEvent e) {
popup.show(button, 0, 0);
}
});
frame.add(popup);
frame.setSize(200, 200);
frame.setVisible(true);
frame.validate();
}
}
REPRODUCIBLE: OFTEN
JDK: 6.0b42
PLATFORM: Any XAWT
###@###.### 2005-07-08 15:54:48 GMT
Compile and execute test below.
Right-click on text area.
Most likely popup menu will blink and hide.
Left click on button.
Popup menu is shown normally and can be navigated using mouse and keyboard.
import java.awt.*;
import java.awt.event.*;
public class PopupMenuTest {
static final Button button = new Button("Click Me");
public static void main(String args[]) throws Exception {
final PopupMenu popup = new PopupMenu();
for(int i=0; i<10; i++) {
Menu menu = new Menu("Main Menu " + i);
for(int j=0; j<10; j++) {
MenuItem menuItem = new MenuItem("MenuItem " + j);
menu.add(menuItem);
}
popup.add(menu);
}
Frame frame = new Frame();
frame.setLayout(new BorderLayout(5, 5));
TextArea label = new TextArea("Text Area");
frame.add(label);
frame.add(button, BorderLayout.SOUTH);
label.addMouseListener(new MouseAdapter() {
public void mousePressed( MouseEvent me ) {
if(me.isPopupTrigger()) {
popup.show(me.getComponent(), me.getX(), me.getY());
}
}
public void mouseReleased( MouseEvent me ) {
if(me.isPopupTrigger()) {
popup.show(me.getComponent(), me.getX(), me.getY());
}
}
});
button.addActionListener(new ActionListener() {
public void actionPerformed( ActionEvent e) {
popup.show(button, 0, 0);
}
});
frame.add(popup);
frame.setSize(200, 200);
frame.setVisible(true);
frame.validate();
}
}
REPRODUCIBLE: OFTEN
JDK: 6.0b42
PLATFORM: Any XAWT
###@###.### 2005-07-08 15:54:48 GMT