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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1, 1.1.5, 1.1.6, 1.2.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      solaris_2.5, solaris_2.6, solaris_10, windows_nt

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: