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

REGRESSION: MouseEvent is incorrectly triggered by clicking JComboBox item

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      rc1
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_nt, windows_2000
    • Verification:
      Verified

      Description



      Name: rmT116609 Date: 09/27/2001


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


      I have a JFrame containing a JComboBox (north) and a JPanel (center). Clicking
      on the JComboBox drops down the list of items, when I click on one of these
      items the mouse click event is sent to the JPanel. (when the JComboBox drops
      down it overlaps the JPanel). This doesn't seem to happen in an earlier beta
      of 1.4 I have on another machine (sorry can't get -version at the moment).

      Demo:

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

      public class TestJComboBox extends JFrame
      {
              public static void main(String[] args)
              {
                      TestJComboBox tjcb = new TestJComboBox();
              }


              public TestJComboBox()
              {
                      JComboBox combo = new JComboBox();
                      JPanel panel = new JPanel();

                      combo.addItem("java");
                      combo.addItem("rocks");

                      panel.addMouseListener(new QuitMouseListener());

                      getContentPane().setLayout(new BorderLayout());
                      getContentPane().add(combo, BorderLayout.NORTH);
                      getContentPane().add(panel, BorderLayout.CENTER);

                      setSize(800, 600);
                      setVisible(true);
              }

              class QuitMouseListener extends MouseAdapter
              {
                      public void mouseClicked(MouseEvent ev)
                      {
                              System.err.println("you clicked the panel!");
                              System.exit(0);
                      }
              }
      }
      (Review ID: 132761)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bchristi Brent Christian
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: