8078269: JTabbedPane UI Property TabbedPane.tabAreaBackground no longer works

Reviewed-by: serb, alexsch
This commit is contained in:
Semyon Sadetsky 2015-06-09 18:57:54 +03:00
parent 032cef6ff8
commit 2fe980e041
2 changed files with 21 additions and 8 deletions

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -896,11 +896,12 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
// Paint the background for the tab area // Paint the background for the tab area
if ( tabPane.isOpaque() ) { if ( tabPane.isOpaque() ) {
if (!c.isBackgroundSet() && (tabAreaBackground != null)) { Color background = c.getBackground();
if (background instanceof UIResource && tabAreaBackground != null) {
g.setColor(tabAreaBackground); g.setColor(tabAreaBackground);
} }
else { else {
g.setColor( c.getBackground() ); g.setColor(background);
} }
switch ( tabPlacement ) { switch ( tabPlacement ) {
case LEFT: case LEFT:

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,9 +21,7 @@
* questions. * questions.
*/ */
import java.awt.Color; import java.awt.*;
import java.awt.Point;
import java.awt.Robot;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import javax.swing.JFrame; import javax.swing.JFrame;
@ -119,6 +117,20 @@ public class Test8007563 implements Runnable {
} }
} }
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();
} }
} }