Why Swing Hacks?
The term hacking has a bad reputation in the press. They use it to refer to
people who break into systems or wreak havoc with computers as their
weapon. Among people who write code, though, the term hack refers to a
quick-and-dirty solution to a problem, or a clever way to get something
done. And the term hacker is taken very much as a compliment, referring to
someone as being creative, having the technical chops to get things done.
The Hacks series is an attempt to reclaim the word, document the good
ways people are hacking, and pass the hacker ethic of creative participation
on to the uninitiated. Seeing how others approach systems and problems is
often the quickest way to learn about a new technology.
In the short term, we hope this book will show you how to do fun things
that will enhance your own applications directly. Some are visual enhance-
ments to make your software look better. Some are functional improve-
ments to make your software do something it couldn’t do before. Some are
even just plain silly, in print only to prove it could be done. Whatever your
interest, we hope you will find both better ways of doing old things and
learn something new about techniques you never even thought of.
In the long term, we hope this book will give you a small glimpse of the
applications coming in the future. This year (2005) we hope will be a water-
shed year for Java on the desktop. Users are demanding more advanced user
interfaces than the Web can provide, and Java is poised to provide them.
New technology is streaming into the Java community at a blistering rate,
and it gives application developers a whole new set of blocks to play with.
This is important because we are going to need these new technologies.
New desktop software promises greater integration between the Web, exter-
nal devices, and software sitting right on your desktop. RSS readers and
iPods. iTunes and photo collaboration. Gaming on desktops, servers, and
cell phones; all at the same time. This is the future of desktop software.
Swing is just a small part of desktop Java, but we feel it is the focal point—
the place where desktop technology (AWT, Java2D, JavaSound), network
technology (web services, XML, JXTA), and device technology (iPods, cell
phones, TVs) all converge upon Java. Many of the hacks in this book are not
strictly about Swing, but about using Swing to do cool things with the rest of
the world. And it’s more than just “cool”—animation is a powerful way to
show a change in content or context, and sound can get the user’s attention
when he or she is away from the keyboard. These features are important
parts of delivering user-centric, quality desktop applications.