[Ldsoss] AntiAlias Java
Ben Galbraith
junk at galbraiths.org
Fri Aug 25 12:54:18 EDT 2006
On Aug 24, 2006, at 8:20 AM, Tom Welch wrote:
> Many java applications if using swing tend to have really ugly
> UI's. The fonts look terrible.
> I wrote some code that can make them look a whole lot better.
> This code requires jre 1.5.
If you're on JDK5, just set this system property:
swing.aatext=true
and Swing will use anti-aliasing throughout.
If you're not on JDK5, probably best to create your own look-and-feel
that simply subclasses an existing look and adds anti-aliasing to the
UI delegates.
> j.putClientProperty
> (com.sun.java.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY,Boolean.TRUE)
> ;
Using com.sun.* classes is risky. For something as trivial as a
constant, probably best to define the constant yourself and use it
that way. With Apple in the fray as a popular JRE implementor, this
problem is not theoretical, though I suspect this code would still
work as they in practice do include a lot of Sun's impl. in their own.
Ben
More information about the Ldsoss
mailing list