changeset 12396:5a31dd5e01cf

8078269: JTabbedPane UI Property TabbedPane.tabAreaBackground no longer works Reviewed-by: serb, alexsch
author ssadetsky
date Fri, 14 Jul 2017 13:03:03 +0100
parents 0209cfe97e57
children 83b863df0737
files src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java test/javax/swing/JTabbedPane/8007563/Test8007563.java
diffstat 2 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Thu Jun 29 12:00:09 2017 -0400
+++ b/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Fri Jul 14 13:03:03 2017 +0100
@@ -806,11 +806,12 @@
 
         // Paint the background for the tab area
         if ( tabPane.isOpaque() ) {
-            if (!c.isBackgroundSet() && (tabAreaBackground != null)) {
+            Color background = c.getBackground();
+            if (background instanceof UIResource && tabAreaBackground != null) {
                 g.setColor(tabAreaBackground);
             }
             else {
-                g.setColor( c.getBackground() );
+                g.setColor(background);
             }
             switch ( tabPlacement ) {
             case LEFT:
--- a/test/javax/swing/JTabbedPane/8007563/Test8007563.java	Thu Jun 29 12:00:09 2017 -0400
+++ b/test/javax/swing/JTabbedPane/8007563/Test8007563.java	Fri Jul 14 13:03:03 2017 +0100
@@ -21,9 +21,7 @@
  * questions.
  */
 
-import java.awt.Color;
-import java.awt.Point;
-import java.awt.Robot;
+import java.awt.*;
 import java.util.ArrayList;
 import java.util.concurrent.CountDownLatch;
 import javax.swing.JFrame;
@@ -119,6 +117,20 @@
             }
 
         }
-        invokeLater(this);
+        SecondaryLoop secondaryLoop =
+                Toolkit.getDefaultToolkit().getSystemEventQueue()
+                        .createSecondaryLoop();
+        new Thread() {
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(200);
+                } catch (InterruptedException e) {
+                }
+                secondaryLoop.exit();
+                invokeLater(Test8007563.this);
+            }
+        }.start();
+        secondaryLoop.enter();
     }
 }