Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
JComboBox.setLightWeightPopupEnabled() is supposed to allow a program to instruct the combobox whether or not lightweight popups should be used. This doesn't seem to work at all, ast he program below demonstrates: import java.awt.*; import com.sun.java.swing.*; public class Test extends JFrame { public Test() { super("Mix Popup Test"); Box box = Box.createVerticalBox(); getContentPane().add("Center", box); // Create Lightweight Swing ComboBox JComboBox light = new JComboBox(); light.setLightWeightPopupEnabled(false); light.addItem("Apple "); light.addItem("Plum "); light.addItem("Banana "); light.addItem("Cherry "); // Create Heavyweight AWT Button Button heavy = new Button("Heavyweight Button"); // Add light & heavy components to box box.add(Box.createVerticalStrut(40)); box.add(light); box.add(Box.createVerticalStrut(20)); box.add(heavy); box.add(Box.createVerticalStrut(40)); pack(); } public static void main(String[] args) { Test t = new Test(); t.show(); } } erik.larsen@Eng 1998-06-09 webbug from ###@###.### JPopupMenu.setLightWeightPopupEnabled(false) does not work on Solaris. Popup menus are obscured by heavyweight components even when lightweight menus are turned off. Under WinNT4, it works. It fails under Solaris. import java.awt.*; import com.sun.java.swing.*; public class MenuBug extends JFrame { public static void main(String args[]) { new MenuBug().setVisible(true); } public MenuBug() { getContentPane().add(new Canvas(), BorderLayout.CENTER); JMenuBar jcMenubar = new JMenuBar(); JMenu jcMenu = new JMenu("File"); jcMenu.getPopupMenu().setLightWeightPopupEnabled(false); jcMenu.add(new JMenuItem("Item 1")); jcMenu.add(new JMenuItem("Item 2")); jcMenu.add(new JMenuItem("Item 3")); jcMenu.add(new JMenuItem("Item 4")); jcMenubar.add(jcMenu); setJMenuBar(jcMenubar); setSize(300, 300); } }
|