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

Ungrab event sent by JInternalFrame causes cancelation of JComboBox menu

XMLWordPrintable

    • b01
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 / OpenJdk 11.0.12

      This issue was introduced in JDK 10.0.23 and we have confirmed it is still present in the JDK 17 GA release from 14th September 2021.

      A DESCRIPTION OF THE PROBLEM :
      For https://bugs.openjdk.java.net/browse/JDK-8173739 the following change was made:

      https://github.com/openjdk/jdk/commit/4b8cfe5a6058cdada1ad6efbb8f81e2f8f53a177

      Now, when a JInternalFrame becomes unselected it generates a sun.awt.UngrabEvent.

      These ungrab events trigger the unintended cancelation of JComboBox drop-down menus (as described in the "steps to reproduce" section).

      REGRESSION : Last worked in version 8u301

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create two internal frames, A and B, with a JComboBox in B. Arrange A and B so they are both visible but A has focus.

      Click on the JComboBox is B. The JComboBox popup menu will appear momentarily but be immediately canceled (perhaps so quickly that you don't even see it appear).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The menu should appear and stay visible - instead of being immediately popped back down for no obvious reason. This was the behavior prior to the JDK-8173739 related change.

      ACTUAL -
      At the moment, the MouseEvent, which causes the menu to appear, is followed by a sun.awt.Ungrab event from the JInternalFrame that just lost focus and this causes the menu to immediately disappear.

      ---------- BEGIN SOURCE ----------
      https://github.com/george-hawkins/jinternalframe-bug

      The README describes how to demonstrate the problem and also how to demonstrate a workaround for the problem.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Subclass JInternalFrame and override the methods setSelected and dispose such that they contain identical code to the actual implementation in JInternalFrame but with the ungrab event generation removed.

      FREQUENCY : always


            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: