8211703: JInternalFrame : java.lang.AssertionError: cannot find the internal frame
authorpsadhukhan
Thu, 23 May 2019 10:50:47 +0530
changeset 55178 e448d58051ab
parent 55177 eba6a83dc23b
child 55179 d85b366bd8f4
8211703: JInternalFrame : java.lang.AssertionError: cannot find the internal frame Reviewed-by: prr, serb
src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	Tue May 21 14:41:43 2019 +0530
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	Thu May 23 10:50:47 2019 +0530
@@ -1471,7 +1471,14 @@
         JComponent comp = context.getComponent();
         JComponent titlePane = findChild(comp, "InternalFrame.northPane");
 
-        JInternalFrame jif = findInternalFrame(comp);
+        JInternalFrame jif;
+        if (comp instanceof JButton) {
+            JComponent bTitlePane = (JComponent)comp.getParent();
+            Container titlePaneParent = bTitlePane.getParent();
+            jif = findInternalFrame(titlePaneParent);
+        } else {
+            jif = findInternalFrame(comp);
+        }
         if (jif == null) {
             return;
         }
--- a/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Tue May 21 14:41:43 2019 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Thu May 23 10:50:47 2019 +0530
@@ -64,6 +64,7 @@
 
 /*
  * @test
+ * @bug 8211703
  * @key headful
  * @summary Verifies SwingSet3 InternalFrameDemo page by checking the different
  *  actions on the parent frame, internal frame and creating internal frame