On Thu, 9 Feb 2023 02:59:11 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> Issue is observed that after changing the Look & Feel from Metal to Nimbus
>> and back to Metal, the Nimbus font continues to be used by a JFileChooser.
>> This is because Synth `installDefaults `methods set the font, but its
>> inverse methods `uninstallDefaults `do not remove them.
>> Fix is made to reset the font if it is set by L&F.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Update test
test/jdk/javax/swing/JFileChooser/JFileChooserFontReset.java line 69:
> 67: Font curFont = fc.getFont();
> 68: System.out.println("current font " + curFont);
> 69: if (curFont != null && !curFont.equals(origFont)) {
Is it valid that `currFont` is `null`?
Do we expect that `origFont.equals(curFont)` returns `true`? And I assume
`origFont` shouldn't be `null` either. So the condition could be simplified to
Suggestion:
if (!origFont.equals(curFont)) {
test/jdk/javax/swing/JFileChooser/JFileChooserFontReset.java line 71:
> 69: if (curFont != null && !curFont.equals(origFont)) {
> 70: throw new RuntimeException(
> 71: "JFileChooser font did not reset after Look &
> Feel change");
Suggestion:
"JFileChooser font is not reset after Look & Feel
change");
-------------
PR: https://git.openjdk.org/jdk/pull/12180