8078269: JTabbedPane UI Property TabbedPane.tabAreaBackground no longer works
Reviewed-by: serb, alexsch
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java Tue Jun 09 14:11:11 2015 +0300
+++ b/jdk/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/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java Tue Jun 09 14:11:11 2015 +0300
+++ b/jdk/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();
}
}