-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
x86
-
windows_nt
Name: dbT83986 Date: 01/06/99
In JDK 1.2, setDefaultLightWeightPopupEnabled(false) does not
force nested JMenu's to heavy weight as it should. However
this works correctly in JDK1.1.7a (Swing 1.0.3 also known as
JFC 1.1). You can see this in the following example, try to
pick a "Steak" from the "Heavy Menu":
--------------------------------------------------------------
/*
* This code based on from Amy Fowler's example. It adds
* Nested JMenu's, which can not be seen under JDK 1.2 (bug) but work fine in JDK 1.1.7a
* http://java.sun.com:81/products/jfc/tsc/archive/tech_topics_arch/mixing/mixing.html
*/
import java.awt.*;
import javax.swing.*; // JDK 1.2
//import com.sun.java.swing.*; // for JDK 1.1.7a
public class MixPopupTest extends JFrame {
public MixPopupTest() {
super("Mix Popup Test");
JMenuBar menubar = new JMenuBar();
setJMenuBar(menubar);
// Create lightweight-enabled menu
JMenu menu = new JMenu("Lite Menu");
JMenu submenu = new JMenu("Salads");
submenu.add("Chef");
submenu.add("Garden");
menu.add(submenu);
menu.add("Fruit Plate");
menu.add("Water");
menubar.add(menu);
// Create lightweight-disabled menu
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
menu = new JMenu("Heavy Menu");
submenu = new JMenu("Steak Bug");
submenu.add("10 lbs (lightweight bug)"); // <- Not seen
submenu.add("20 lbs (lightweight bug)"); // <- Not seen
menu.add(submenu);
menu.add("Gravy");
menu.add("Banana Split");
menubar.add(menu);
// Create Heavyweight AWT Button
Button heavy = new Button(" Heavyweight Button ");
// Add heavy button to box
Box box = Box.createVerticalBox();
box.add(Box.createVerticalStrut(20));
box.add(heavy);
box.add(Box.createVerticalStrut(20));
getContentPane().add("Center", box);
pack();
}
public static void main(String[] args) {
MixPopupTest t = new MixPopupTest();
t.setSize(400,200);
t.show();
}
}
// Resize the JFrame so it is very small, and the missing "Steak"
// JMenu becomes heavy weight.
(Review ID: 48974)
======================================================================
- duplicates
-
JDK-4188832 Medium weight submenus hidden by heavyweight Canvas
-
- Resolved
-