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

REGRESSION: Can't select an item in a JComboBox after opening a menu in Win LAF

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.4.0
    • client-libs



      Name: rmT116609 Date: 11/05/2001


      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

      The bugs appears when you try to select an item in a combo box after having opened (and closed) a menu :
      for example a menu in a JMenuBar or the header menu of an JInternalFrame. Once the menu have been
      opened and closed it is impossible to select an item in the JComboBox.

      This bug occurs only when you use the Windows look and feel.

      Here is a source code to test the problem :

      import java.awt.*;
      import javax.swing.*;

      public class TestPopupBug extends JFrame {
      public TestPopupBug() {
      super("Test Popup Menu Bug");
      JMenu menu = new JMenu("Menu");
      menu.add(new JMenuItem("Menu Item"));
      JMenuBar menuBar = new JMenuBar();
      menuBar.add(menu);
      setJMenuBar(menuBar);
      getContentPane().setLayout(new FlowLayout());
      JComboBox combo = new JComboBox();
      combo.addItem("First item");
      combo.addItem("Second item");
      combo.addItem("Third item");
      getContentPane().add(combo);
      setBounds(300,300,300,100);
      setVisible(true);
      }

      public static void main(String[] args) {
      try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      }
      catch (Exception ex) {
      System.out.println(ex);
      }
      new TestPopupBug();
      }
      }

      You run the program and, if you don't click on the menu "Menu" in the menubar,
      there is no problem, you can select as many times as you want all the items in
      the combo box.
      Once you have clicked on the menu "Menu", if you click on the combo box, the
      popup menu appears but anywhere you click (to select an item or on the
      scrollbar of the popup menu) the popup menu will disapear and the selected item
      won't change.
      After that, if you click again on the menu "Menu", you can change the selected
      item in the combo box but only one time before the bug appears again.

      I'm working under Windows2K pro with jdk1.4beta3. This bug did not exist under
       jdk1.4beta. Perhaps it's due to the bug 4493400 under jdk1.4beta2 and now
       fixed in beta3?.

      The problem is not reproducible with JDK1.3.1_01
      (Review ID: 135029)
      ======================================================================

            peterz Peter Zhelezniakov
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: