changeset 12261:733caeaa6901

8078269: JTabbedPane UI Property TabbedPane.tabAreaBackground no longer works Reviewed-by: serb, alexsch
author ssadetsky
date Tue, 09 Jun 2015 18:57:54 +0300
parents 6582b35eb5f1
children f040f8b2b4b1
files src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java test/javax/swing/JTabbedPane/8007563/Test8007563.java
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Jun 09 14:11:11 2015 +0300
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Jun 09 18:57:54 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -896,11 +896,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	Tue Jun 09 14:11:11 2015 +0300
+++ b/test/javax/swing/JTabbedPane/8007563/Test8007563.java	Tue Jun 09 18:57:54 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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();
     }
 }