On Tue, 25 Jun 2024 04:05:00 GMT, Alisen Chung <[email protected]> wrote:
> Currently the bug described in the issue is that the colors of the
> TextComponents do not change when set ySystemColor.control color when the
> TextComponents are set to uneditable. You can check by changing
> TextComponent.getBackground() code to return Color.GRAY on line 342 and you
> can see that TextComponents are not changing to a gray background when set to
> uneditable.
>
> This fix adds a private setBackground method in TextComponent so that
> TextArea and TextField can change the background color to the correct color
> (SystemColor.control) when set uneditable by overriding the TextComponent
> setEditable. You can verify the fix by changing this color to Color.GRAY and
> verifying the backgrounds change to gray when the TextComponents are disabled.
src/java.desktop/share/classes/java/awt/TextArea.java line 615:
> 613: Color defaultBackground =
> UIManager.getColor("TextArea.background");
> 614: if (!backgroundSetByClientCode) {
> 615: setBackground(b ? defaultBackground : SystemColor.control,
> false);
Is there a reason behind choosing `SystemColor.control` as the default
TextComponent system color?
I see another option `SystemColor.text` - the description sounds more close to
the background color of text components.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19876#discussion_r1663506190