-
Bug
-
Resolution: Fixed
-
P4
-
1.1.6, 1.1.7, 1.2.0
-
1.2.2
-
generic, x86, sparc
-
generic, solaris_2.6, windows_nt
Name: rk38400 Date: 11/10/98
/*
Try this. The medium weight submenus are hidden
by the heavyweight Canvas.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MenuBug extends JFrame {
public MenuBug() {
// for Medium Weight menus
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
// Create the menus
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
menuBar.add(fileMenu);
JMenu sm;
fileMenu.add(new JMenuItem("New"));
fileMenu.add(new JMenuItem("Open"));
fileMenu.add(new JMenuItem("Save"));
fileMenu.add(sm = new JMenu("Save As..."));
// these guys don't show up
sm.add(new JMenuItem("This"));
sm.add(new JMenuItem("That"));
// Enable exiting.
JMenuItem fileExit = new JMenuItem("Exit");
fileExit.addActionListener(FILE_EXIT_ACTION);
fileMenu.add(fileExit);
setJMenuBar(menuBar);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt)
{
System.exit(0);
}
});
// Create a panel containing a blue canvas
JPanel p = new JPanel(new BorderLayout());
Canvas field = new Canvas();
field.setBackground(Color.blue);
p.add(field, BorderLayout.CENTER);
getContentPane().add(p);
setSize(400,400);
setVisible(true);
}
public static void main(String[] args) {
new MenuBug();
}
public AbstractAction FILE_EXIT_ACTION =
new AbstractAction("Exit") {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
};
}
(Review ID: 42331)
======================================================================
- duplicates
-
JDK-4201072 setDefaultLightWeightPopupEnabled(false) doesnt work for nested JMenu's (JDK1.2)
-
- Closed
-
-
JDK-4225630 Heavyweight JPopupMenu does not display its submenus over a JFrame
-
- Closed
-