Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
WELCOME to Filthy Rich Clients. This book is about building better, more effective, and cooler desktop applications using graphical and animated effects. We started writing this book after our successful session on the topic at the JavaOne conference in 2006. The session explored the use of animation, advanced 2D effects, and even some 3D effects to create richer applications. But it seemed we could have spoken for days on the subject. Understanding why you should develop such applications, how the technologies that enable them work, and how you can properly develop effects that enable Filthy Rich Clients is, well, a rich topic indeed.
Hence, this book. Now we get to spend the next many pages with you, discussing fundamentals of Java, Swing, Java 2D, graphics, graphical user interfaces (GUIs), animation, performance, and advanced effects that build on all of these fundamentals in order to create beautiful applications.
Please join us for the ride. It should be fun.
The book has a sequential flow from beginning to end, so readers may want to work through it in that order, at least to understand how the material is arranged. There are plenty of code snippets and discussions in the book that are also appropriate for random access, although the technology behind any particular item might relate back to earlier discussions in the book. These relationships are generally noted when they arise so that you can more easily refer back to earlier material as background.
The original intent of the book was to explain the cool effects that we show mostly toward the end of the book. But there is currently no book, to our knowledge, that explains the background of Swing, graphics, Java 2D rendering, and animation that is necessary to understand how the effects work. So we start at the beginning. We develop the fundamentals in these areas early on, building upon them as we go, so that by the time you read the material at the end of the book, everything should make sense.[1]
[1] Think of it as a GeneralPath to enlightenment.
This book provides not only plenty of snazzy example effects you can use to create Filthy Rich Clients but also the knowledge of how it all works so that you can go further on your own.
Part I covers the fundamental concepts of Java graphics and user interface programming that we use throughout the rest of the book. A comprehensive description of graphics and user interface development is beyond the scope of this book, but we cover the basic areas that enable Filthy Rich Clients sufficiently to get everyone up to speed with the APIs, techniques, and details necessary to understand the later chapters that build upon these elements.
If you have a solid understanding of AWT, Java 2D, and Swing already, some of the material at the beginning of this section may be old hat for you. However, we build upon these basic concepts as we go. Also, there are plenty of interesting, deep tidbits throughout the book that should be useful to all Desktop Java programmers.
Part II covers more advanced topics in Java 2D and Swing that are useful in creating rich interfaces. The first half of Part II covers graphics-specific technologies of composites, gradients, and image processing. The second half of Part II covers more Swing-focused technologies: the glass pane, layered panes, and the repaint manager.
A Filthy Rich Client is not static; it is alive. It needs to move. It needs to transition. It needs a heartbeat so that the user knows it is there. Looking good is half the battle. Looking alive is the rest of it.
Part III is about the fundamentals of animation that you can use to bring your applications to life. We cover some of the basics of animating graphics and GUIs, discuss the existing facilities in the Java SE core libraries for assisting in developing animations, and cover the Timing Framework library that makes developing animations in Java much easier.
Part IV builds upon everything covered in the earlier parts of the book. Effects are at the core of Filthy Rich Clients, making the difference between a mere rich client and a Filthy Rich Client. The effects are grouped into two categories. The first category is static effects, which use graphics techniques for a richer look in applications. The second category is dynamic, or animated, effects for making GUIs move. We also cover Animated Transitions, another animated effect that is enabled through a utility library available on the book’s Web site. The section ends with a chapter that shows how a sample Filthy Rich Client was developed, from initial design diagrams through implementation of the various effects.
We have adopted an informal writing style for the book because we really feel that we are talking to you, the reader. It is not unusual for one of us to use the word “I” in any particular passage in the book. The trick is to figure out which one of us is speaking. It really doesn’t matter, of course, and you probably don’t care. But in case you do, here’s a hint: The pictures and screenshots in Romain’s sections are generally more attractive, and there are more footnotes and raw text in Chet’s sections. These differences map well to our characters: Romain has a great aesthetic sense and takes beautiful pictures, and Chet talks a lot.
Experience with the Java language and Swing is helpful. This book is not a primer on those subjects but rather assumes some familiarity with Java and Swing. However, some of the rendering fundamentals of Swing, which are important to understand in creating Filthy Rich Clients, may not be evident to even advanced Swing programmers, so the first couple of chapters of the book are devoted to explaining how Swing and Java 2D work together to create the kinds of customizable effects that we explore throughout the rest of the book.
We have compiled information relevant to the book on the Web site http://filthyrichclients.org. This site has everything from demos to utility libraries used in the book to other information about the book and related technologies as appropriate. We’re positive there are absolutely no miisteakes in this book, but if a miracle occurs and we’re wrong about that, expect the errata to show up on this Web site.
The book is full of demo code.[2] There are snippets of code spread throughout the pages. In most cases, this code is copied from demos that are posted on the book’s Web site. Where we refer to an available demo in the text, look for an “Online Demo” icon, like the one next to this paragraph, and the project name to look for on the book’s Web site. Each of these demo projects contains the buildable and runnable source code that allows you to see the application in action as well as to use the code as you see fit in your projects. The demos are not just trivial items to ignore. We expect you to go to the Web site and check things out. We specifically developed the demos hand-in-hand with writing the book, and the material in the software on the Web site integrates well with the book material throughout every chapter.
[2] How full is it? It’s so full that our code font got so exhausted it caught mono. It’s so full that we edited the book by running lint on it. It’s so full that you could compile the text in the book if it weren’t for all of these annoying footnotes.
There are also utility libraries used and described in the book. These libraries are useful for some of the demos we developed, but more importantly they are intended to be used as standalone libraries for your projects.
These libraries are available in ongoing development projects on other Web sites, listed below, but versions are provided on the book’s Web site, http://filthyrichclients.org, that match the version used in the book. These libraries include:
Timing Framework: This library is described in detail in two chapters in this book (hint: look for the chapters whose names begin with the words “Timing Framework”). The project is being developed at http://timingframework.dev. java.net, but a specific version of the library that matches the one used for the code and descriptions in this book is available on the book’s Web site.
Animated Transitions: This library is described toward the end of the book in Chapter 18, cleverly named “Animated Transitions.” Again, this project will probably also be available on java.net, although it is not yet posted at the time of this writing. But regardless, a version that matches that described in the book will be available on the book’s Web site.
There are many projects out there that would be good to investigate in the pursuit of Filthy Rich Clients, but some in particular are mentioned in the book and used in some of our demos:
SwingLabs: Many of the utilities mentioned in the context of demos and snippets in the book are available on the SwingLabs Web site. Be sure to check out these and other technologies at http://swinglabs.dev.java.net.
JOGL: The Java bindings for OpenGL library provides a way to write 3D applications and effects in Java using the OpenGL API and hardware acceleration across most platforms on which Java runs. You can find JOGL at http://jogl.dev.java.net.
We both post irregularly but often to our blogs. When you want to know more about graphics, performance, Java 2D, and Java Desktop Client technologies in general, go visit Chet’s technical blog at http://weblogs.java.net/blog/chet/. When you want to see more exciting visuals, go check out the latest Swing demos and discussions on Romain’s English-friendly blog at www.curious-creature.org.
You will find invaluable information on those two Web sites that perfectly complements the book. You may even get the chance to read sneak previews of sequels to this book without even knowing it. In fact, we won’t know it either when we post the entries, so we’ll be even.
If you enjoy reading some of this book’s footnotes, please check out Chet’s informal humor blog at http://chetchat.blogspot.com. Finally, if you are lucky enough to read French, do not hesitate to visit Romain’s French blog at www.progx.org, which is an absurd mix of funny stories and programming advice.