RFR: 7188058: Background of TextComponents are not changing colors to the default disabled color when set to uneditable

Alisen Chung achung at openjdk.org
Mon Jul 1 16:43:45 UTC 2024


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.

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

Commit messages:
 - add test
 - init commit

Changes: https://git.openjdk.org/jdk/pull/19876/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19876&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-7188058
  Stats: 164 lines in 4 files changed: 161 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/19876.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19876/head:pull/19876

PR: https://git.openjdk.org/jdk/pull/19876


More information about the client-libs-dev mailing list