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

REGRESSION: Unselectable combo box after using a popup menu

XMLWordPrintable

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



      Name: jk109818 Date: 01/02/2002


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

      FULL OPERATING SYSTEM VERSION :
      Windows 2000 Version 5.00

      ADDITIONAL OPERATING SYSTEMS :

      Windows 98 Version 4.10

      A DESCRIPTION OF THE PROBLEM :

      This problem occurs on NT 2000 and Windows 98 operating
      systems.
      It does not occur on NT4.

      After showing a popup menu, selecting an item from a drop
      list belonging
      to a combo box is not possible anymore.

      It also occurs when showing a system menu of an internal
      frame, or a
      menu of a Jframe.

        To reproduce the problem with the sample below, click
      anywhere on
      the client area of the sample, click on the combo box'
      button to get it
      open, and click on one of the items. You may see that the
      item is not
      selected.

      Note also that, if one clicks on the combo box to get it
      open, and drags to
      select an item, then the item will be correctly selected.

      This bug causes 1.3 applications to be quite unsable with
      1.4 version beta 3.
      It seems that the problem has appeared from beta 3.

      Best regards,
      Jean-Bernard

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        To reproduce the problem with the sample below, click
      anywhere on
      the client area of the sample, click on the combo box'
      button to get it
      open, and click on one of the items. You may see that the
      item is not
      selected.

      Note also that, if one clicks on the combo box to get it
      open, and drags to
      select an item, then the item will be correctly selected.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /**
       * ComboBox1Merlin.java
       */
      import java.lang.*;
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      /**
       * Class: ComboBox1Merlin
       */
      public class ComboBox1Merlin extends javax.swing.JFrame
         {
          JPopupMenu popupMenu;
          /**
           * Constructor: ComboBox1Merlin
           * @return instance of ComboBox1Merlin
           */
          public ComboBox1Merlin()
             {
              super();

              JMenuItem ppMenuItem = new JMenuItem();
              /* Bean Properties */
              ppMenuItem.setName("JMenuItem");
              ppMenuItem.setText("MenuItem");
              ppMenuItem.setEnabled(false);
              
              JMenu ppMenu = new JMenu();
              /* JMenuItem - Bean Properties */
              ppMenu.setName("JMenu");
              ppMenu.setText("Menu");
              /* Adds Child */
              ppMenu.add(ppMenuItem);

              /* JPopupMenu */
              popupMenu = new JPopupMenu();
              /* Adds Child */
              popupMenu.add(ppMenu);

              JLabel label = new JLabel();
              /* JLabel - Bean Properties */
              label.setName("JLabel");
              label.setText("Click here...");
              
      label.setHorizontalAlignment(javax.swing.SwingConstants.CENT
      ER);
              /* JComboBox - sets Bounds */
              label.setBounds(28,180,250,22);
              
              JComboBox comboBox = new JComboBox();
              /* JComboBox - Bean Properties */
              comboBox.setName("JComboBox");
              /* JComboBox - sets Bounds */
              comboBox.setBounds(35,50,100,22);
              comboBox.setPreferredSize(new
      java.awt.Dimension(100,22));
              for (int i = 0; i < 10; i++)
                   comboBox.addItem("" + i);
              
              final JPanel panel = new JPanel();
              panel.addMouseListener(new
      java.awt.event.MouseAdapter()
                {
                 public void
      mousePressed(java.awt.event.MouseEvent e)
                    {
                     popupMenu.show(panel,e.getX(),e.getY());
                    }
                });
              /* JPanel - Bean Properties */
              panel.setName("JPanel");
              /* JPanel - set Layout */
              panel.setLayout(null);
              /* JPanel - Adds Child */
              panel.add(comboBox);
              panel.add(label);
                              
              /* javax.swing.JFrame - Bean Properties */
              
      setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
              setName("JFrame");
              setTitle("Title");
              /* javax.swing.JFrame - sets Bounds */
              setBounds(50,100,400,400);
              /* javax.swing.JFrame - Adds Child */
              
      getContentPane().add(panel,java.awt.BorderLayout.CENTER);
             } /* End of Constructor: ComboBox1Merlin */

          /**
           * Method: generalHandleException <br>
           * @param java.lang.Throwable exception
           * @return void
           */
          protected void
      generalHandleException(java.lang.Throwable exc)
             {
              exc.printStackTrace(System.err);
             } /* End of Method: generalHandleException */

          /**
           * Method: main <br>
           * Note: Called only if we're an application. <br>
           * @param java.lang.String[] args the command line
      arguments
           * @return void
           */
          public static void main(java.lang.String[] args)
             {
              try
                 {
                  /* Set native look and feel */
                  
      javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.g
      etSystemLookAndFeelClassName());

                  /* Creates new MainObject */
                  ComboBox1Merlin self = new ComboBox1Merlin();
                  self.show();
                 } /* End try */
              catch (java.lang.Throwable exc)
                 {
                  exc.printStackTrace(System.err);
                 } /* End catch */
             } /* End of Method: main */

         } /* End of Class: ComboBox1Merlin */


      ---------- END SOURCE ----------

      Release Regression From : 1.3.1
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 137665)
      ======================================================================

            peterz Peter Zhelezniakov
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: