I'm working on a fairly big Swing-based app (JPanels, JLabels, etc) and I have to find out why text-antialiasing (on JLabels etc) is not working.
As you may know, antialiasing normally works automagically (with Java 1.6 anyway), that is, when one creates a simple Swing-app (for example, just a JPanel with a JLabel on it) the text on the JLabel will be antialiased out of the box. No need for System.setProperty("awt.useSystemAAFontSettings","on")
and/or System.setProperty("swing.aatext", "true")
.
But this app is different, it does not antialias out of the box, it does not antialias with System.setProperty("awt.useSystemAAFontSettings","on")
and/or System.setProperty("swing.aatext", "true")
in the main(String[] args)
, on also not with -Dawt.useSystemAAFontSettings=on
and/or -Dswing.aatext=true
as VM-arguments. I've tried these and other all suggestions I could find on this site and on internet, but to no avail: this app just never antialiases, whatever I do or don't.
I'm out of options now. So my questions are:
All insights are welcome.
Try the advice in System Properties for Java 2D™ Technology: awt.useSystemAAFontSettings.
As of 1.6, it looks like swing.aatext
is ignored. However, as noted by @Andrew, awt.useSystemAAFontSettings
should work...
One of the things you might want to do is dump out the Map
for the awt.font.desktophints
desktop property just to see what, if anything, has been set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With