RFR: 8075917: The regression-swing case failed as the text on label is not painted red with the GTK L&F [v5]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Mar 6 08:45:46 UTC 2024


On Tue, 5 Mar 2024 11:06:18 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java line 205:
>> 
>>> 203:     private Color getLAFDefinedColor(SynthContext context, int state,
>>> 204:                                      ColorType type, String propertyName) {
>>> 205:         Color c = (Color) get(context, propertyName);
>> 
>> I guess these condition checks should also be done inside the method since you are passing the values anyway...
>> Also, the enabled state are still not handled..If the existing testcase does not catch those, maybe we can add subtests to it..
>
>> Also, the enabled state are still not handled
> 
> The enabled state is not handled in Metal LAF also, tried adding the enabledText property by setting ui property --
> `UIManager.getDefaults().put("CheckBox.enabledText", checkboxColor);`
> 
> but the checkbox/radiobutton is painted with default black color.
> Should we handle the change in metal LAF as well?

Backtracking a bit, regarding `Label.foreground` why it needs to be done here?

Other L&F, it is added in corresponding LookAndFeel class
for example, in [Metal](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java#L1001)
and in [Windows](https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java#L880)
etc
so I think it is needed to be added in GTKLookAndFeel class

and additionally there is setting of `Label.foreground` and other Label. property in BasicLabelUI.java [installDefaults](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java#L368)
but we dont do it for Nimbus or GTK or Synth so I guess we need to call `super.installDefaults(c)` in SynthLabelUI class since there is no GTKLabelUI class
or 
maybe do
`LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font");` alone to avoid other properties being set and to not fallback

Please check if it will work
and if it does, then we need to employ similar for checbox/radiobutton/togglebutton

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17763#discussion_r1514050005


More information about the client-libs-dev mailing list