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

Alisen Chung achung at openjdk.org
Wed Jul 3 23:42:20 UTC 2024


On Wed, 3 Jul 2024 19:39:10 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> Currently the bug described in the issue is that the colors of the TextComponents do not change when setting TextComponents to uneditable. The default uneditable color (SystemColor.control) happens to be the same as the default for the editable color for some L&Fs, so the fix may not be initially noticeable. However, the bug still exists where the the color is not being changed when changing between editable and 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/TextComponent.java line 366:
> 
>> 364:         super.setBackground(c);
>> 365:     }
>> 366: 
> 
> Does this need a method need a javadoc comment block like the `setBackground` method before it or like any of the methods in the class?

since this method isn't a public or protected method (it's package-private, so it can't be accessed by users) there's no need for a javadoc comment

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19876#discussion_r1664911554


More information about the client-libs-dev mailing list