Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java Applications

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $11.94
Usually ships in 1-2 business days
(Save 76%)
Other sellers (Paperback)
  • All (12) from $11.94   
  • New (7) from $28.95   
  • Used (5) from $11.94   

Overview

Filthy Rich Clients refers to ultra-graphically rich applications that ooze cool. They suck the user in from the outset and hang on to them with a death grip of excitement. Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java™ Applications shows you how to build better, more effective, cooler desktop applications that intensify the user experience.

The keys to Filthy Rich Clients are graphical and animated effects. These kinds of effects provide ways of enhancing the user experience of the application through more attractive GUIs, dynamic effects that give your application a pulse, and animated transitions that keep your user connected to the logical flow of the application. The book also discusses how to do so effectively, making sure to enrich applications in sensible ways.

In-depth coverage includes

  • Graphics and GUI fundamentals: Dig deep into the internals of how Swing and Java 2D work together to display GUI applications onscreen. Learn how to maximize the flexibility of these libraries and use them most effectively.
  • Performance: Follow in-depth discussions and tips throughout the book that will help you write high-performing GUI applications.
  • Images: Understand how images are created and used to make better Java applications.
  • Advanced graphics: Learn more about elements of Swing and Java 2D that are of particular benefit to Filthy Rich Clients.
  • Animation: Discover general concepts of animation, as well as how to use the facilities provided in the Java platform. Learn new utility libraries that vastly simplify animations in Java.
  • Effects: Learn how to create, customize, and use static and animated effects—the mainstays of Filthy Rich Clients.

Code examples illustrate key concepts, and the book’s companion Web site, http://filthyrichclients.org, includes extensive demos, utility libraries, additional information on related technologies, and more.

Informal, fun, and, most of all, useful, this book is great for any developer working with Java to build desktop applications.

Read More Show Less

Product Details

  • ISBN-13: 9780132413930
  • Publisher: Addison-Wesley
  • Publication date: 8/23/2007
  • Series: Java Series
  • Pages: 608
  • Sales rank: 1,430,760
  • Product dimensions: 6.90 (w) x 9.30 (h) x 1.40 (d)

Meet the Author

Chet Haase is a client architect in the Java SE group at Sun Microsystems. Passionate about graphics, he works with all desktop Java technologies, including Swing and Java 2D. He’s worked with graphics technologies from 2D to 3D and from applications down to the driver level. Chet holds an M.S. in computer and information sciences from the University of Oregon and a B.A. in math from Carleton College.

Romain Guy has served as a software engineer at Google and on the Swing Team at Sun Microsystems. His primary interests are graphics and graphical user interface development. Romain has written for several print and online journals, and he holds an M.S. in computer and information sciences.

Read More Show Less

Read an Excerpt

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.Organization

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 thebackground 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

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: Graphics and GUI Fundamentals

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: Advanced Graphics Rendering

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.Part III: Animation

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: Effects

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.Style

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.Reader Requirements

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.External Resources

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.Web Site Code

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 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.Web Site Libraries

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.
Other Projects

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.
Other Web Resources

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.NOTES:

1. Think of it as a

GeneralPath to enlightenment.
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 probably compile the text in the book if it weren’t for all of these annoying footnotes.

Read More Show Less

Table of Contents

Foreword xvii

Preface xix

Acknowledgments xxv

About the Authors xxvii

Introduction 1

Part I: Graphics and GUI Fundamentals 9

Chapter 1: Desktop Java Graphics APIs: Swing, AWT, and Java 2D 11

Abstract Window Toolkit (AWT) 12

Java 2D 13

Swing 13

Chapter 2: Swing Rendering Fundamentals 15

Events 16

Swing Painting 17

Swing Rendering 20

Double-Buffering 28

Threading 31

Chapter 3: Graphics Fundamentals 43

Java 2D 43

Rendering 45

Chapter 4: Images 91

Image Types 92

BufferedImage 95

Image Scaling 98

Chapter 5: Performance 115

Use the Clip 115

Compatible Images 121

Managed Images 126

Intermediate Images 134

Optimal Primitive Rendering 143

Benchmark 144

Command-Line Flags 145

Part II: Advanced Graphics Rendering 151

Chapter 6: Composites 153

AlphaComposite 153

AlphaComposite: The 12 Rules 155

Creating and Setting Up an AlphaComposite 163

Common Uses of AlphaComposite 164

Issues with AlphaComposite 168

Create Your Own Composite 170

Summary 177

Chapter 7: Gradients 179

Two-Stops Linear Gradient 179

Special Effects with Regular Gradients 182

Multistops Linear Gradient 187

Radial Gradient 189

Optimizing Gradients 193

Chapter 8: Image Processing 199

Image Filters 200

Processing an Image with BufferedImageOp 201

AffineTransformOp 203

ColorConvertOp 204

ConvolveOp 206

LookupOp 211

RescaleOp 213

Custom BufferedImageOp 214

A Note about Filters Performance 222

Summary 222

Chapter 9: Glass Pane 223

Painting on the Glass Pane 225

Blocking Input Events 230

Chapter 10: Layered Panes 237

Using Layered Pane Layers 238

Ordering Components within a Single Layer 242

Layered Panes and Layouts 243

Alternative to JLayeredPane with Layouts 244

Chapter 11: Repaint Manager 249

When Swing Gets Too Smart 249

Meet the RepaintManager 251

A Reflection on RepaintManager 253

Summary 262

Part III: Animation 263

Chapter 12: Animation Fundamentals 265

It’s About Time 265

Fundamental Concepts 266

Frame-Based Animation 266

Timing (and Platform Timing Utilities) 275

Resolution 288

Animating Your Swing Application 300

Summary 314

Chapter 13: Smooth Moves 315

Background: Why Does My Animation Look Bad? 315

What Makes Animations Choppy, and How to Smooth Them Out 316

SmoothMoves: The Demo 335

Summary 341

Chapter 14: Timing Framework: Fundamentals 343

Introduction 343

Core Concepts 345

Interpolation 359

Summary 378

Chapter 15: Timing Framework: Advanced Features 379

Triggers 379

Property Setters 392

Summary 420

Part IV: Effects 421

Chapter 16: Static Effects 423

Blur 423

Reflection 434

Drop Shadows 437

Highlights 442

Sharpening 450

Summary 458

Chapter 17: Dynamic Effects 459

Motion 460

Fading 465

Pulse 473

Spring 484

Morphing 489

Summary 495

Chapter 18: Animated Transitions 497

Animating Application State Segues 497

Animated Transitions: The Library 501

Example: SearchTransition 503

Example: SearchTransition Revisited: Customization 516

Example: ImageBrowser 519

Animated Transitions: Under the Hood, or How Do You Get Swing to Do That? 527

Summary 530

Chapter 19: Birth of a Filthy Rich Client 531

Aerith 531

Workflow Paper Design 533

The Vision 535

Screen Paper Design 537

Mockup 538

From Mockup to Code 540

But . . . I’m Not an Artist! 544

Choosing Nice Colors 545

Read Design Books 547

Summary 548

Conclusion 549

Index 553

Read More Show Less

Preface

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.

Organization

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

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: Graphics and GUI Fundamentals

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: Advanced Graphics Rendering

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.

Part III: Animation

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: Effects

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.

Style

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.

Reader Requirements

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.

External Resources

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.

Web Site Code

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 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.

Web Site Libraries

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.

Other Projects

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.

Other Web Resources

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.

NOTES:

1. Think of it as a GeneralPath to enlightenment.
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 probably compile the text in the book if it weren’t for all of these annoying footnotes.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)