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

REGRESSION: JPopupMenu doesn't highlight selection on initial click

    XMLWordPrintable

Details

    Description

      Name: jk109818 Date: 06/21/2002


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

      FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000
      [Version 5.00.2195] Service Pack 2


      A DESCRIPTION OF THE PROBLEM :
      Displaying a JPopupMenu with a left mouse click so that the
      mouse position resides within the popup may result in a
      wrong selection of the popup item. If the popup does at
      least partially overlap with the border of a JFrame, the
      item under the mouse is selected correctly with the
      selection color. If the popup does reside fully inside the
      JFrame, the first item is selected, even when the mouse is
      on another item when clicked.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile/start code/class TestJPopupMenu
      2. Click somewhere in the middle without moving the mouse
      after the click.
      3. Note the position of the mouse relative to the popup. Is
      the popup over another than the first item? Which item is
      selected?
      4. Do step 2 and 3 but click near the border of the frame.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Result of step 3 is that the selected item is always the
      first one, not taking the mouse position into account.

      Result of step 4 is that the correct item is selected.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.*;
      import java.util.*;
      import javax.swing.*;
      public class TestJPopupBug extends javax.swing.JFrame {
      private JPopupMenu popup = new JPopupMenu("Test");
      private int size = 600;
      public TestJPopupBug() {
      popup.add("Level01");
      popup.add("Level02");
      popup.add("Level03");
      popup.add("Level04");
      popup.add("Level05");
      this.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      }
      } );
      this.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
      popup.show(TestJPopupBug.this,
      e.getX() - (int)(70 * Math.random()),
      e.getY() - (int)(100 * Math.random()));
      }
      } );
      this.setSize(size, size);
      this.setVisible(true);
      }
      public static void main(String[] s) {
      new TestJPopupBug();
      }
      }
      ---------- END SOURCE ----------

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

      (Review ID: 153845)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              alexp Alexander Potochkin (Inactive)
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: