On Fri, 24 Feb 2023 00:07:20 GMT, Phil Race <p...@openjdk.org> wrote:

> And if a default font prevents the FontUIResource from being installed, how 
> does it get installed the in the first place ?
Perhaps that first time the component has no peer and it really is null ?

The font is null when it's created. Calling `getFont` causes it to go up the 
hierarchy, if it has a parent. The UI looks to be initialized (and thus a font 
is set) before `getFont` is called.

> FontUIResource is something devised by Swing, for Swing.
Making AWT components depend on it for the convenience of Swing is backwards.

D'oh.

> It seems you would have to explicitly track whether the app set the font omn 
> the JComponent rather than using this mechanism .. and if it did not then 
> ignore whatever the font is ??
But I'm guessing and it adds just another bit more risk+complexity to this 
change.

Sounds like the path would be to undo my last commit and just put a note in the 
code.

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

PR: https://git.openjdk.org/jdk/pull/10565

Reply via email to