JDK-4112982 : JComboBox.setLightWeightPopupEnabled(false) fails to turn off lightweight popup
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.1,1.1.5,1.1.6,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    solaris_2.5,solaris_2.6,solaris_10,windows_nt solaris_2.5,solaris_2.6,solaris_10,windows_nt
  • CPU: generic,x86,sparc
  • Submitted: 1998-02-18
  • Updated: 1998-09-09
  • Resolved: 1998-09-09
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
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);
	}
}

Comments
PUBLIC COMMENTS JComboBox.setLightWeightPopupEnabled(false) fails to turn off lightweight popup.
10-06-2004

EVALUATION This is a problem with JPopupMenu. The JPopupMenu is trying to create a medium-weight and it's not working. I think it should be trying to create a heavy-weight instead. tom.santos@eng 1998-06-01 There are two problems listed in the description, one is an AWT problem which is fixed in 1.1.7, the other is a focus problem with medium weight popups which is already reported as 4168483 georges.saab@Eng 1998-09-09
09-09-1998