I have this in-house Swing Look&Feel, and as is usual for a migration to Java 11, usages of SwingUtilities2
members are to be replaced by official APIs.
Most are solved, but I haven't found any working advice how to crack anti-aliasing.
The L&F is built as a subclass of BasicLookAndFeel
, which has mechanisms for anti-aliasing; however, these seem to require activation through defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, AATextInfo.getAATextInfo(SwingUtilities2.isLocalDisplay()));
, which replicates what other Swing L&Fs are doing to enable AA, but with Java 11 this API isn't accessible anymore.
I have fiddled with setting RenderingHints
in many likely and even some unlikely places, to no avail; for some reason, the settings never gain traction.
I am almost done analyzing the situation using the debugger (breakpoint on the L&F's LabelUI.paint()
function and single-stepping through all the decisionmaking logic), but I found that BasicLookAndFeel
seems to be hardcoded to use AATextInfo
objects to pass hints, which I can't use if I maintain my own L&F.
So... what are my options?
I could probably use a different base class, but that's... scary.
(I know that @kleopatra has called anti-aliasing a "story-without-happy-ending", but this is about picking up the preconfigured hints and properly applying them, not about wilfully switching AA on or off.)