<Swing Dev> RFR: 8058704: Nimbus does not honor JTextPane background color

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Jul 29 12:03:56 UTC 2021


On Thu, 29 Jul 2021 11:44:31 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.

test/jdk/javax/swing/plaf/nimbus/TestNimbusJTextPaneColor.java line 53:

> 51:                 JTextPane tp = new JTextPane();
> 52:                 tp.setForeground(Color.WHITE);
> 53:                 tp.setBackground(Color.BLACK);

There's a brief flash of white background before the actual and proper background color is set. Since the functionality of JTextPane background is rectified/restored, I have raised the PR and I will work on the initial white flashing in a subsequent PR.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4930


More information about the swing-dev mailing list