RFR: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
Damon Nguyen
dnguyen at openjdk.org
Fri Aug 18 18:06:34 UTC 2023
On Mon, 14 Aug 2023 03:31:37 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:
> Disabled JPasswordField foreground color was not grayed out in GTK LAF.
>
> The foreground color in disabled state was close to black color (RGB 0,0,0) for password field which is not differentiable from enabled state foreground color.
>
> To fix for this problem, the widget type is changed to `TEXT_AREA `for disable password field which returns the foreground color as gray. Checked with Oracle linux as well and fix worked fine.
>
> An automated test case has been added and checked in CI, link is added in JBS. Test mentioned in JBS also works fine with the fix.
src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c line 2409:
> 2407: && color_type == FOREGROUND) {
> 2408: widget_type = MENU;
> 2409: } else if (widget_type == PASSWORD_FIELD && state_type == GTK_STATE_INSENSITIVE
Looks like this line and a few others nearby exceed the character limit per line if you wanted to correct that as well.
test/jdk/javax/swing/JPasswordField/TestDisabledPasswordFieldForegroundColor.java line 58:
> 56: SwingUtilities.invokeAndWait(() -> {
> 57: createAndShowUI();
> 58: });
Suggestion:
SwingUtilities.invokeAndWait(TestDisabledPasswordFieldForegroundColor::createAndShowUI);
test/jdk/javax/swing/JPasswordField/TestDisabledPasswordFieldForegroundColor.java line 110:
> 108: if (img1.getWidth() == img2.getWidth()
> 109: && img1.getHeight() == img2.getHeight()) {
> 110: for (int x = 10; x < img1.getWidth()/2; ++x) {
Suggestion:
for (int x = 10; x < img1.getWidth() / 2; ++x) {
test/jdk/javax/swing/JPasswordField/TestDisabledPasswordFieldForegroundColor.java line 111:
> 109: && img1.getHeight() == img2.getHeight()) {
> 110: for (int x = 10; x < img1.getWidth()/2; ++x) {
> 111: for (int y = 10; y < img1.getHeight()-10; ++y) {
Suggestion:
for (int y = 10; y < img1.getHeight() - 10; ++y) {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15263#discussion_r1298721040
PR Review Comment: https://git.openjdk.org/jdk/pull/15263#discussion_r1298718982
PR Review Comment: https://git.openjdk.org/jdk/pull/15263#discussion_r1298719351
PR Review Comment: https://git.openjdk.org/jdk/pull/15263#discussion_r1298719517
More information about the client-libs-dev
mailing list