-
Bug
-
Resolution: Fixed
-
P1
-
1.1.2
-
1.1.4
-
generic, sparc
-
solaris_2.5.1
-
Not verified
If you run the provided example and select "Re-build Popup Menu",
java dumps core.
I have tried several work-a-rounds, but I have not found any way to
remove sub-menu items from a popup-menu. Great if you could tell me
about any work-a-rounds...
We have waited for 1.1.2 to solve our popup-menu problems and were
glad so see that the previously reported bug (4039089) in this area is
solved now. Not so happy about this new one though... :-(
/Janne
###@###.###
import java.awt.*;
import java.awt.event.*;
public class PopupBug extends Frame
{
private Button popupButton;
private PopupMenu popup;
public PopupBug()
{
super();
setTitle("Popup Bug");
setLayout(new FlowLayout());
addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent event) {
System.exit(0);
}
});
popupButton = new Button("Click for popup menu");
popupButton.addMouseListener(
new MouseAdapter() {
public void mousePressed(MouseEvent e) {
popup.show((Component)e.getSource(), e.getX(), e.getY());
}
});
buildPopupMenu();
add(popupButton);
Button button = new Button("Re-build Popup Menu");
button.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
buildPopupMenu();
}
});
add(button);
pack();
setVisible(true);
}
protected void buildPopupMenu()
{
if (popup != null) {
// if popup menu already created, remove items
// BUG ALERT: dumps core on Solaris!
popup.removeAll();
}
else {
// 1'st time, create popup menu
popup = new PopupMenu("popup");
popupButton.add(popup);
}
// Add simple items
popup.add(new MenuItem("1'st item"));
popup.add(new MenuItem("2'nd item"));
// Add sub-menu
Menu submenu = new Menu("Sub menu");
submenu.add("Sub-item 1");
submenu.add("Sub-item 2");
submenu.add("Sub-item 3");
popup.add(submenu);
}
public static void main(String argv[])
{
new PopupBug();
}
}
nasser.nouri@Corp 1997-06-19
nasser.nouri@Corp 1997-07-21
- duplicates
-
JDK-4059218 Crash in Java v1.1.2 & v1.1.3 (with Popups on Solaris)
-
- Closed
-