RFR: 8278620: properties installed by javax.swing.LookAndFeel installColors and installColorsAndFont are not uninstalled [v3]

Phil Race prr at openjdk.org
Fri Feb 24 00:10:04 UTC 2023


On Mon, 20 Feb 2023 08:08:22 GMT, SWinxy <duke at openjdk.org> wrote:

> Figured it out. When setting a Component's font to null, it inherits the font from the component tree.

Good to know but ..

> Changing the fallback font type to a FontUIResource in the peers fixes this. 

Sorry, but I don't think we should do this.

FontUIResource  is something devised by Swing, for Swing.
Making AWT components depend on it for the convenience of Swing is backwards.
And I'm quite surprised that WComponentPeer is EVER used by Swing.
AWT components on Windows are heavyweight - and that peer is for them and Swing is lightweight.

Did you actually try all 3 platforms ?

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 ?

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.

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

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



More information about the client-libs-dev mailing list