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

JButton gets stuck when clicked inside a JMenu (sample included)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: js151677 Date: 08/04/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      When you click on a JButton that is inside a JMenu, it gets stuck and does not release. Mouseover shows a pressed down state, mouseout shows a non-pressed state, but you can keep moving your mouse over and out without the button being released. This doesn't happen on JRE1.4 and lower. It's new to 1.5 (or should I say 5.0).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Place a JButton in a JMenu and click it.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Rectangle;
      import javax.swing.*;

      public class Test extends JFrame {

          public Test() {
              
              super("Test");
              
              JMenu subMenu = new JMenu("Sub Menu");
              subMenu.add(new JButton("Sub Menu Button"));
              
              JMenu menu = new JMenu("Menu");
              menu.add(subMenu);
              menu.add(new JButton("Main Button"));
              
              JMenuBar menubar = new JMenuBar();
              menubar.add(menu);
              
              this.setJMenuBar(menubar);
              
              setBounds(new Rectangle(200, 200, 200, 200));
              setVisible(true);
          }
          
          public static void main(String args[]) {
              
              new Test();
          }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 290400)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kizune Alexander Zuev
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: