Skip to Content
Swing Hacks
book

Swing Hacks

by Joshua Marinacci, Chris Adamson
June 2005
Intermediate to advanced
544 pages
22h 24m
English
O'Reilly Media, Inc.
Content preview from Swing Hacks
Anti-Aliased Text with a Custom Look and Feel #55
Chapter 7, Text
|
285
HACK
that
SwingUtilities2
is an undocumented and hidden class for which no
support will ever be provided. This means that it can be changed without
notice. Using it might break your applications in a future release of Java.
—Romain Guy
H A C K
#55
Anti-Aliased Text with a Custom
Look and Feel Hack #55
Another way to get smooth text is to use a custom Look and Feel to avoid the
fragile Java 5.0 APIs.
When the Java 5.0 anti-aliasing trick [Hack #54] was first discovered, some dis-
cussions arose on the Web. Many people strongly disagree with using it
because it can be broken at any time by Sun Microsystems. Should we be
deprived of anti-aliased text because of such a silly problem? Frédéric Lav-
igne, author of the famous Skin L&F and webmaster of www.javootoo.com,
a great repository of Look and Feels for Swing, didn’t think so and found an
elegant and clever way to get the same result.
The Wrap Look and Feel
His idea is to use a custom Look and Feel whose sole purpose is to enable
anti-aliasing hints on the
Graphics instances used to draw the UI. He imple-
mented his idea in the Wrap Look and Feel, which can be downloaded at
wraplf.l2fprod.com. Another Look and Feel, SmoothMetal, enables anti-
aliasing in your application. Yet, you are stuck with Metal Look and Feel
when using it. Wrap Look and Feel acts as a decorator for the current
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Swing GUI Programming

Learning Swing GUI Programming

Brian Cole
Java Swing

Java Swing

Robert Eckstein, Marc Loy, Dave Wood
JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second Edition

JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second Edition

Kathy Walrath, Mary Campione, Alison Huml, Sharon Zakhour

Publisher Resources

ISBN: 0596009070Purchase bookErrata Page