Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Articles Book Excerpt and Review: Filthy Rich Clients - Developing Animated and Graphical Effects for Desktop Java Applications

Book Excerpt and Review: Filthy Rich Clients - Developing Animated and Graphical Effects for Desktop Java Applications

Desktop Java developers have long lacked extensive resources on how to push the graphical appearance of their applications.  Chet Haase and Romain Guy attempt to fill this void with their new book Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java Applications.  The following is a review of the title by Andy Roberts. 

In addition to the review, we have the privilege of offering an excerpt of Chapter 14 to help you make your own decision. Chet Haase, one of the books authors introduces the excerpt as follows:
We've covered a lot about Swing and 2D rendering fundamentals by this time, and have also discussed animation basics. This chapter is an introduction to the Timing Framework library that makes Java animation programming much easier.
As always, comments from others who have already read the book are welcome.


What are Filthy Rich Clients?

The term "Filthy Rich Clients" was only coined relatively recently by the authors to describe "applications that are so graphically rich that they ooze cool. [...] In short, they make users actually enjoy their application experience". With that in mind, the book goes on to explain how to utilise Java2D and Swing in order to enhance your desktop applications. The authors are eminently qualified to explore the topic. Chet Haase is a client architect at Sun Microsystems and works closely with Java2D and Swing. Romain Guy never seems to stand still for too long as he was worked in various areas of the IT industry. During his time as an intern at Sun Microsystems be rose to the ranks of Java Rock Star and gained a lot of kudos for developing and presenting two filthy rich clients at the last two JavaOne conferences.

Who is this book for?

Quite simply, this is for developers who what to make their Java desktop applications look "cool". As we can see with Windows Vista, Mac OS X, and Office 2007, various effects can actually enhance an application's usability. It's not just for media players and instant messenger clients. Naturally, there is no substitute for a fully functioning application behaving as the user expects. It is for those who want to take their rich client to the next level and try and create visually appealing interfaces to make users increasingly comfortable.

Why am I interested?

I've have developed a range of Java Swing applications for several years now. Although relatively content with the average desktop experience, one of my more recent projects met resistance due to its Java roots and unfounded performance "problems". Once I started making it filthy (although this was in the pre-filthy rich client era), the detractors were less bothered about the so-called Java problem and actually enjoyed using it because it looked cooler than the alternatives.

I must admit, I don't particularly enjoy getting my hands dirty writing Java2D code and extending JComponents. I'm usually perfectly happy to rely on a decent 3rd party look and feel, such as the rather good Substance Look and Feel to add a bit of glitz to my apps. I just want to write working applications. However, I always enjoy a visually appealing application, so I know I should offer a decent experience to my users also. And now here's a book to teach developers exactly how to do so.

Content Relevance

For the authors, the "filthy" aspect equates to effects and animations: Gradients, reflections, drop shadows, fades, transitions, etc. Java is extremely versatile and all the effects are possible; the problem is that there's a lot of groundwork required to achieve them. Firstly there are the fundamental graphic algorithms to grasp. Then these must be translated into something Java2D can compute. This is followed with how to get the images drawn to display and behave properly within Swing. On top of this, there are always performance issues to consider. In short, there is a real need for some experts to guide developers through the surprisingly complex world of creating graphically rich applications.

The book comprises of 19 chapters that are divided up into four parts:

  • Graphics and GUI fundamentals
  • Advanced graphics rendering
  • Animation
  • Effects

Although it's only part I with "fundamentals" in its title, in my view, the first three parts are all in fact laying foundations. Like with The Karate Kid, there's a lot of waxing on and waxing off before you get to kick-ass!

Part I lays out the most essential information in the journey to graphical enlightenment. The chapter on Swing and threading is perhaps as good a review of the topic as you'll ever read. This is followed by a tour through the most applicable parts of the Java2D package that you need to get to grips with. The final area is about understanding 'images' within a Java context: the various types, how to use them, and how to obtain optimal performance with them.

The real bread and butter elements come in Part II, where the reader is introduced to advanced graphics rendering techniques. It is here that you learn how to use composites, create gradients, draw reflections, and apply filters to images. It is also where you begin to learn the power of the GlassPane in Swing and how to use layered panes. It's within these chapters that you start to realise that there are caveats-a-plenty. Obviously, this is why the book exists in order to show you where potential "gotchas" lie and present best-practice.

Part III deals with animation and, speaking personally, was an extremely enjoyable read. This was surprising given that I didn't think I was that interested in the topic! Animation concepts are succinctly covered, as are the key assets within the Java platform that provide the tools for animations, namely timing mechanisms. The section ends with two chapters presenting Chet's Timing Framework. Its raison d'etre is to make animation and timing as simple as possible. As the book illustrates, there is a lot of boiler-plate code required in order to setup timers and determine the current progress of the animation. This framework takes all that tedium away, and it also provides many other useful classes for setting up triggers (events that cause the animation to begin) and interpolation (defining how frames progress throughout the animation). As libraries go, this is an extremely good example of a cleanly designed API that is very fit for its purpose and makes a potentially tricky task very easy to handle.

And finally, the climax of the book comes in part IV, which deals with effects. This is ultimately where you bring together the knowledge conveyed in the previous three parts and put it in to practice - it is here that you truly start to build filthy rich clients. Various static effects are demonstrated, such as blurs (for making backgrounds less distracting when popups are visible), drop shadows, reflections and highlights. There is a follow up chapter on dynamic effects, like fades, pulses, springs and morphs. A chapter on transitions is particularly interesting and presents a strong case for why interfaces should not instantly jump to various screens without making it clear how they relate to each other. This is also where the reader is introduced to the book's second library called Animated Transitions, written expressly for dealing with transitions. Again, it's another well thought-out API that is really going to make life easier for developers to add this type of functionality. It facilitates moves, scales, fades and rotations as standard, with the ability to plug-in your own custom transitions if need be.


The book is extremely well written and really rather absorbing. It is fairly informal in style, and given that it weighs in at approximately 600 pages, it is probably a good thing. Anyone who reads Chet's blog will know that he's not adverse to the odd corny-joke or two, and the book isn't immune from those - they don't really add a great deal, although they don't detract either.

In fairness this book does not cover terribly trivial topics, and given that the chapters are all easy to digest, it is a great testament to the authors' ability to communicate their field of expertise. The writing is great, the figures are always beneficial and the code snippets are very well utilised. A tricky balance, no doubt. The obvious difficulty is that trying to illustrate animations and dynamic effects by definition is not easy on a static medium. To make the most of the book you do have to spend some time with the sample demos and source code.

Code Examples

The difficulty in writing programming textbooks is getting the right balance in terms of the amount of code to embed with the pages of the book. It all depends on the concept being explained, of course. In Filthy Rich Clients, they do a pretty good job in this regard. There are many code samples demonstrating how various tasks should be written, which is exactly what you expect, yet each snippet is kept to the bare minimum, and very rarely due listings exceed a page in length. This is often achieved with substituting blocks of code with a single lined comment when such blocks are not essential for the understanding of the current sample. It's a good technique, and whilst it sometimes means you can't do a verbatim copy from the book's pages, much more digestable, and the reader is fully aware that the full code is available from the companion website.

Most of the source code presented in the book are snippets from taken purposely written demo applications which are available for downloading. These are bundled in a zip file per chapter, and are aimed at being easily loaded and run using Netbeans. It would have been ideal if the authors had supplied compiled versions, perhaps as WebStart bundles allowing easy execution with just a double-click, although maybe I'm just being picky.

At the time of writing not all the examples are available. The demos for chapters 16-18 are absent (there are no samples for chapter 19, in case you were wondering), which is a shame as these are the ones covering the various desktop effects and transitions. As a consequence, it's not yet possible to obtain a copy of the Animated Transitions library.


Let us be clear, this book will not make you a better programmer. It will not teach you how to use Swing; nor will you learn how to architect desktop applications properly. Chet and Romain's Filthy Rich Clients is purely about how to go about enhancing various aspects of your existing, fully functioning desktop applications.

This is a great book: expertly written, clearly explained and a great pace. It doesn't stray beyond its remit and doesn't linger too long on any particular concept.

I wasn't surprised, but still a little dismayed that the area of look and feels wasn't tackled. Repeatedly extending various components per application is not a good long-term strategy. With all the hype that is starting to surround the forthcoming Nimbus look and feel it's clear that developers and users get excited at having an immediately attractive interface. At the end of the day, you can add all the transitions, drop shadows and reflections you like, but nobody is going to think that Swing's standard Metal look and feel is "cool". I appreciate it's a vast topic and perhaps too large to tackle along side the rest of the existing content. Some reference and pointers would have been interesting, however.

Minor gripe aside, there is still much to learn that will be beneficial. It is left as an exercise for the reader to determine which enhancements are suitable for their applications. I know that I was itching to try out every example after reading each effect being described. The authors must know that they are potentially about to unleash the desktop equivalent to pimp-my-ride! Caution should be exercised in order to avoid overdone, effect-laden visuals. Still, it's really positive to see a book showing off the excellent capabilities of the Java platform. There really is little excuse any more for Java not to conquer the desktop!

Copyright: This excerpt represents a portion of Chapter 14 from the new book, Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java Applications, authored by Chet Haase and Romain Guy, published by Addison-Wesley, as part of Sun Microsystems Press, August, 2007, Copyright 2008 Sun Microsystems, Inc. ISBN-13: 9780132413930. For more information, please visit:

Rate this Article