Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4112982

JComboBox.setLightWeightPopupEnabled(false) fails to turn off lightweight popup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1, 1.1.5, 1.1.6, 1.2.0
    • client-libs
    • None
    • generic, x86, sparc
    • solaris_2.5, solaris_2.6, solaris_10, windows_nt

      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);
      }
      }

            gsaab Georges Saab
            amfowler Anne Fowler (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: