New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8058704: Nimbus does not honor JTextPane background color #4930
Conversation
|
Webrevs
|
Does the JEditorPane have the same issue? |
I noticed when running |
You're removing the default background which was painted previously. Does it mean there's no default any more? What will paint the background if it's not set explicitly?
Yes, fixed |
<paintPoints x1="0.25" y1="0.0" x2="0.2" y2="0.1"/> | ||
</rectangle> | ||
</shapes> | ||
<shapes/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between background and shape tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked at https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults.html where default color for
EditorPane.background and TextPane.background is NimbusBlueGrey and not White what we have now, so I think we are having what is being specified in nimbus-default.
SwingSet2 background color for the demos are same before and after the fix.
I am not sure about the difference between background and shape but I have ran full JCK/JTREG tests and all are fine. I also tried passing Nimbus L&F via CI script for JCK/jtreg tests and those are also same before and after fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the linke above the
nimbusBlueGrey #a9b0be (169,176,190)
While the "EditorPane.background and TextPane.background" are:
TextPane.background #d6d9df (214,217,223)
EditorPane.background #d6d9df (214,217,223)
It is still unclear why setting these values in the XML file prevents the user to change it later, also it will be good to understand the purpose of "shape" since it also sets some coordinates values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I meant the grey background what is being described in EditorPane.background and TextPane.background is what is being shown now, not literally NimbusBlueGrey. Till now we were showing white which is in contrary to this default.
I could not find any purpose of shape by looking at skin.laf as it is not being used in Synth source code, so that is why I ran all JCK/jtreg testsuite and found no regression. It is also there from initial days.
I leave it for user of Synth/Nimbus L&F or anyone from open community to highlight the need of "shape"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean that "shapes" tag is not used and we can remove all its usage in the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know. I am only telling by looking at source code..I dont know what NimbusL&F creator meant it for...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should give this fix a chance...sInce this is solving 2 long-standing issue where setBackground() contract is not honoured plus causing no regression to existing tests.
If we do find any testcase with "shape" in future from open community or any other related testcase being failed for this fix, we can always work on it (or at the least roll back this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks the fix doesn't work or alternatively it works in an unexpected way.
Both JEditorPane and JTextPane used to have white background but now, with these changes, their background is the same of the panel below. It's probably know what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last time this code was touched we get a regression https://bugs.openjdk.java.net/browse/JDK-8266510 which was not found by any tests. JCK cannot found them since this is L&F dependent. And regression tests do not have related tests because we had never bugs here, it worked this way from the beginning.
So it will be good to understand why these tags prevent the color change, how the shape tags are used, instead of some unknown changes here and there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JDK-8266510 regression was found by SwingSet2 so it is wrong to say it was not found by any test, maybe it was not verified during fix of JDK-8249674. For this, all existing test is run.
You should add JDK-6789980 as an additional issue resolved:
|
@aivanov-jdk Only the author (@prsadhuk) is allowed to issue the |
The tests are nearly the same: the only difference is the component being tested. I suggest merging the two tests into one test which tests both components one after another. |
Restored "shape" tag and now tackling the bug from the fact that JTextField/JTextARea setbackground works unlike JTextPane/EditorPane.
but for JTextPane/EditorPane, we have
where color2 is NimubsLightBackground so it seems to always paint white. |
All CI test including JCK are green. |
I would rather have as separate test as the fix is in 2 different component, I could have raised separate PRs as fix area is different although fix seems to be same..and I don't see it as anyhting other than test optimization.. |
/issue add JDK-6789980 |
@prsadhuk |
I'm for fixing these two issues under one PR. The fix is basically the same, so it makes it easier to review and track changes later. Yes, it's kind of a test optimisation. Yet the tests are similar in nature, they exercise the same behaviour in two different components. It just makes sense to re-use the code. If a fix is necessary to one test, it is necessary for the other — same idea why avoiding duplicate code is good. It's not a show-stopper though if everyone agrees it's better to have two different tests. |
OK..Not a problem. Merged... |
Now both JTextPane and JEditorPane have white background by default. The changes to the background color are honored. |
@prsadhuk This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 189 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
This looks fine, please double-check other usages of "shapes and matte" in "skin.laf" probably we have similar bugs in other components? |
/integrate |
Going to push as commit 0c4be76.
Your commit was automatically rebased without conflicts. |
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.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4930/head:pull/4930
$ git checkout pull/4930
Update a local copy of the PR:
$ git checkout pull/4930
$ git pull https://git.openjdk.java.net/jdk pull/4930/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4930
View PR using the GUI difftool:
$ git pr show -t 4930
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4930.diff