On Tue, 27 Sep 2022 17:33:46 GMT, Alexey Ivanov <[email protected]> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Get color once during init
>
> src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLabelUI.java line
> 222:
>
>> 220: if (fgColor != null) {
>> 221: label.setForeground(fgColor);
>> 222: }
>
> Why is the color set to the `label` component during paint?
>
> Shouldn't it be `g.setColor(fgColor)`? And the above code which uses the
> `context` should be skipped if `fgColor != null`.
There are 2 ways JLabel can be used, one via html label and another normal
label. Normal label text will work if we do `g.setColor(fgColor)` but html
label will use
[StyleSheet.paint](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java#L1939)
which does not take into account foreground Color (guess unless it's provided
by html tags which is not the case here) so I need to explicitly set the
foreground color of label
-------------
PR: https://git.openjdk.org/jdk/pull/9900