<Swing Dev> RFR: 8058704: Nimbus does not honor JTextPane background color [v4]
Alexey Ivanov
aivanov at openjdk.java.net
Mon Aug 9 16:01:33 UTC 2021
On Mon, 9 Aug 2021 13:28:11 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> The Nimbus look and feel ignores the configured background color of a JTextPane and always uses white.
>> Every other look and feel tested (Metal, Motif, and Windows) correctly honors the configured background color of a JTextPane.
>> Issue seems to be in the hardcoded background color in nimbus skin which is rectified via the fix.
>> After this fix, the background color is correctly updated to whatever is being set via JTextPane.setBackground().
>>
>> CI all test run is green.
>
> Prasanta Sadhukhan has updated the pull request incrementally with two additional commits since the last revision:
>
> - Fix
> - Merge test
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/plaf/nimbus/TestNimbusBGColor.java line 25:
> 23: /*
> 24: * @test
> 25: * @bug 8058704
I believe both bugs should be listed.
test/jdk/javax/swing/plaf/nimbus/TestNimbusBGColor.java line 27:
> 25: * @bug 8058704
> 26: * @key headful
> 27: * @summary Verifies if Nimbus honor JTextPane background color
…JTextPane and JEditorPane…
test/jdk/javax/swing/plaf/nimbus/TestNimbusBGColor.java line 65:
> 63: tp.setForeground(Color.WHITE);
> 64: tp.setBackground(Color.BLACK);
> 65: tp.setText("This text should be white on black");
I meant to pass a component as a parameter to a generic test method.
private static void testComponent(ComponentCreator<? extends JTextComponent> creator) {
// Set Look and Feel
JComponent tc = creator.createComponent();
// set foreground etc and verify
}
I implemented [what I had in mind](https://github.com/aivanov-jdk/jdk/commit/ba9cbc12c10ba6950a3cd491a9c9c022ab0dad2f). I don't think it's important what background color you use for each component. The updated test fails without the fix and passes with your fix.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4930
More information about the swing-dev
mailing list