Tải bản đầy đủ

Filthy rich clients

www.it-ebooks.info


Filthy Rich Clients

www.it-ebooks.info


The Java™ Series
Ken Arnold, James Gosling, David Holmes
The Java™ Programming Language, Fourth Edition

Eric Jendrock, Jennifer Ball
The Java™ EE 5 Tutorial, Third Edition

Joshua Bloch
Effective Java™ Programming Language Guide

Jonni Kanerva
The Java™ FAQ


Stephanie Bodoff, Dale Green, Kim Haase, Eric Jendrock
The J2EE™ Tutorial, Second Edition

Doug Lea
Concurrent Programming in Java™, Second Edition:
Design Principles and Patterns

Mary Campione, Kathy Walrath, Alison Huml
The Java™ Tutorial, Third Edition: A Short Course on
the Basics
Mary Campione, Kathy Walrath, Alison Huml, The
Tutorial Team
The Java™ Tutorial Continued: The Rest of the JDK™
Patrick Chan
The Java™ Developers Almanac 1.4, Volume 1

Rosanna Lee, Scott Seligman
JNDI API Tutorial and Reference: Building DirectoryEnabled Java™ Applications
Sheng Liang
The Java™ Native Interface: Programmer’s Guide and
Specification
Tim Lindholm, Frank Yellin
The Java™ Virtual Machine Specification, Second Edition

Patrick Chan
The Java™ Developers Almanac 1.4, Volume 2
Patrick Chan, Rosanna Lee
The Java™ Class Libraries, Second Edition, Volume 2:
java.applet, java.awt, java.beans
Patrick Chan, Rosanna Lee, Doug Kramer
The Java Class Libraries, Second Edition, Volume 1:
Supplement for the Java™ 2 Platform, Standard Edition,
v1.2


Kirk Chen, Li Gong
Programming Open Service Gateways with Java™
Embedded Server
Zhiqun Chen
Java Card™ Technology for Smart Cards: Architecture
and Programmer’s Guide
Maydene Fisher, Jon Ellis, Jonathan Bruce
JDBC™ API Tutorial and Reference, Third Edition
Eric Freeman, Susanne Hupfer, Ken Arnold
JavaSpaces™ Principles, Patterns, and Practice
Li Gong, Gary Ellison, Mary Dageforde
Inside Java™ 2 Platform Security, Second Edition:
Architecture, API Design, and Implementation
James Gosling, Bill Joy, Guy Steele, Gilad Bracha
The Java™ Language Specification, Third Edition

Roger Riggs, Antero Taivalsaari, Jim Van Peursem, Jyri
Huopaniemi, Mark Patel, Aleksi Uotila
Programming Wireless Devices with the Java™ 2
Platform, Micro Edition, Second Edition
Rahul Sharma, Beth Stearns, Tony Ng
J2EE™ Connector Architecture and Enterprise
Application Integration
Inderjeet Singh, Beth Stearns, Mark Johnson, Enterprise
Team
Designing Enterprise Applications with the J2EE™
Platform, Second Edition
Inderjeet Singh, Sean Brydon, Greg Murray, Vijay
Ramachandran, Thierry Violleau, Beth Stearns
Designing Web Services with the J2EE™ 1.4 Platform:
JAX-RPC, SOAP, and XML Technologies
Kathy Walrath, Mary Campione, Alison Huml, Sharon
Zakhour
The JFC Swing Tutorial, Second Edition: A Guide to
Constructing GUIs
Steve Wilson, Jeff Kesselman
Java™ Platform Performance: Strategies and Tactics
Sharon Zakhour, Scott Hommel, Jacob Royal,
Isaac Rabinovitch, Tom Risser, Mark Hoeber
The Java™ Tutorial, Fourth Edition: A Short Course
on the Basics

Mark Hapner, Rich Burridge, Rahul Sharma, Joseph
Fialli, Kim Haase
Java™ Message Service API Tutorial and Reference:
Messaging for the J2EE™ Platform

www.it-ebooks.info


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

Chet Haase
Romain Guy

Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City

www.it-ebooks.info


Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
Sun Microsystems, Inc. has intellectual property rights relating to implementations of the technology described in this publication. In
particular, and without limitation, these intellectual property rights may include one or more U.S. patents, foreign patents, or pending
applications.
Sun, Sun Microsystems, the Sun logo, J2ME, J2EE, Java Card, and all Sun and Java based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. UNIX is a registered trademark in the United States
and other countries, exclusively licensed through X/Open Company, Ltd. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY
ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR
THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and
assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or
arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include
electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales, (800) 382-3419, corpsales@pearsontechgroup.com.
For sales outside the United States please contact: International Sales, international@pearsoned.com.

Visit us on the Web: www.awprofessional.com
Library of Congress Cataloging-in-Publication Data
Haase, Chet.
Filthy rich clients : developing animated and graphical effects for
desktop Java applications / Chet Haase, Romain Guy.
p. cm.
Includes index.
ISBN 978-0-13-241393-0 (pbk. : alk. paper) 1. Object-oriented
programming (Computer science) 2. Java (Computer program language) I.
Guy, Romain. II. Title.
QA76.73.C153H33 2007
005.1'17—dc22

2007019818

Cover Illustration: Nathan Clement
Copyright © 2008 Sun Microsystems, Inc.
4150 Network Circle, Santa Clara, California 95054 U.S.A.
All rights reserved.
Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher
prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc., Rights and Contracts
Department, 75 Arlington Street, Suite 300, Boston, MA 02116, Fax: (617) 848-7047.
ISBN-13: 978-0-13-241393-0
ISBN-10:
0-13-241393-0
Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts.
First printing, August 2007

www.it-ebooks.info


For Kris
I never quite understood book dedications to spouses/partners/families.
I mean, it always seemed like the polite thing to do, but not really necessary.
Even while I was writing the bulk of my chapters, it just seemed like something
I happened to be doing as part of my work life, completely separate from my
home life. Then came the mad, unending rush at the end and the ensuing
review and editing phase. I basically disappeared from home life
entirely for about three months. Now, I get it.
Thank you, Kris, for supporting me in this project; for dealing with the
house, the kids, and everything else when I was nonexistent;
and for still being here when I finally reappeared.
––Chet

For All of My Friends
You heard me complain one too many times about this book, but you kept
listening to me. Such a load of work could not have come at a worse time.
Thank you for helping me keep what was left of my sanity.
For Chet
Thank you for remaining calm and polite even though you were dying
to see me write my chapters.
For the Swing Team I Knew
Thank you for having faith in me and offering me
so many great opportunities.
––Romain

www.it-ebooks.info


This page intentionally left blank

www.it-ebooks.info


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)
Java 2D
Swing

Chapter 2

12
13
13

Swing Rendering Fundamentals . . . . . . . . . . . . . . . .15
Events
Swing Painting
Asynchronous Repaint Requests
Synchronous Paint Requests
Swing Rendering
paintComponent()
paint()
setOpaque()

16
17
17
19
20
21
24
27
vii

www.it-ebooks.info


viii

CONTENTS

Double-Buffering
Threading
Threading Model
Timers and the Event Dispatch Thread
Painless Threading through SwingWorker
Threading Summary

Chapter 3

Graphics Fundamentals . . . . . . . . . . . . . . . . . . . . . 43
Java 2D
Rendering
Getting the Graphics Object
Graphics State
Graphics Primitives

Chapter 4

43
45
46
48
73

Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Image Types
BufferedImage
Image Scaling
Quality versus Performance
getFasterScaledInstance(): Utility for Faster, Better Scaled Images

Chapter 5

28
31
33
37
38
42

92
95
98
101
111

Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Use the Clip
Compatible Images
Why You Should Care
What about Managed Images?
Make Mine Compatible
Managed Images
Grabbing the DataBuffer
Frequent Rendering to the Image
Intermediate Images
The Big Idea
How It’s Done
Notes
Summary
Optimal Primitive Rendering
Benchmark

www.it-ebooks.info

115
121
122
123
124
126
129
132
134
135
135
141
142
143
144


ix

CONTENTS

Command-Line Flags
Rendering
Debugging Performance

PART II

145
146
148

ADVANCED GRAPHICS RENDERING . . . . . . . . . . . 151

Chapter 6

Composites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153
AlphaComposite
AlphaComposite: The 12 Rules
Clear
Dst
DstAtop
DstIn
DstOut
DstOver
Src
SrcAtop
SrcIn
SrcOut
SrcOver
Xor
Creating and Setting Up an AlphaComposite
Common Uses of AlphaComposite
Using Clear
Using SrcOver
Using SrcIn
Issues with AlphaComposite
Create Your Own Composite
The Add Composite
Implementing the CompositeContext
Composing the Pixels
Summary

Chapter 7

153
155
157
157
158
158
159
159
160
160
161
161
162
162
163
164
165
165
166
168
170
171
174
175
177

Gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
Two-Stops Linear Gradient
Special Effects with Regular Gradients
Multistops Linear Gradient
Radial Gradient

www.it-ebooks.info

179
182
187
189


x

CONTENTS

Optimizing Gradients
Caching the Gradient
Smarter Caching
Optimization with Cyclic Gradients

Chapter 8

Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . 199
Image Filters
Processing an Image with BufferedImageOp
AffineTransformOp
ColorConvertOp
ConvolveOp
Constructing a Kernel
Working on the Edge
LookupOp
RescaleOp
Custom BufferedImageOp
Base Filter Class
Color Tint Filter
A Note about Filters Performance
Summary

Chapter 9

225
227
230
231

Layered Panes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Using Layered Pane Layers
Ordering Components within a Single Layer
Layered Panes and Layouts
Alternative to JLayeredPane with Layouts

Chapter 11

200
201
203
204
206
208
209
211
213
214
215
216
222
222

Glass Pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Painting on the Glass Pane
Optimized Glass Pane Painting
Blocking Input Events
Mouse Events Issues

Chapter 10

193
193
194
195

238
242
243
244

Repaint Manager . . . . . . . . . . . . . . . . . . . . . . . . . . 249
When Swing Gets Too Smart
Meet the RepaintManager
Managing the RepaintManager

www.it-ebooks.info

249
251
252


xi

CONTENTS

A Reflection on RepaintManager
Making Room for the Reflection
Painting the Reflection
A Dumber, Therefore Smarter, RepaintManager
Summary

PART III

253
253
257
259
262

ANIMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

Chapter 12

Animation Fundamentals . . . . . . . . . . . . . . . . . . . .265
It’s About Time
Fundamental Concepts
Frame-Based Animation
Frame Rate
Time-Based Motion
Timing (and Platform Timing Utilities)
“What Time Is It?”
“Can I Get a Wake-up Call?”
“Call Me Again. And again. And again.”
Resolution
Resolution of System.currentTimeMillis()
and System.nanoTime()
Sleeping Resolution
Timer Resolution
Resolution about Resolution
Animating Your Swing Application
Animated Graphics
Animated GUIs
Summary

Chapter 13

265
266
266
268
268
275
275
279
280
288
291
293
297
299
300
301
303
314

Smooth Moves . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315
Background: Why Does My Animation Look Bad?
What Makes Animations Choppy,
and How to Smooth Them Out
Timing Is (Nearly) Everything
Color: What’s the Difference?
Vertical Retrace: That Syncing Feeling
SmoothMoves: The Demo
Creating the Graphics Objects
Running the Timer

www.it-ebooks.info

315
316
317
320
329
335
335
335


xii

CONTENTS

Rendering
Rendering Options
Summary

Chapter 14

Timing Framework: Fundamentals . . . . . . . . . . . . . 343
Introduction
Core Concepts
Animator
Callbacks
Duration
Repetition
Resolution
Start Behavior
Interpolation
Acceleration and Deceleration
Interpolator
Summary

Chapter 15

343
345
346
348
350
351
352
352
359
360
364
378

Timing Framework: Advanced Features . . . . . . . . 379
Triggers
Concepts and Usage
Triggers Superclasses
The Built-In Triggers
Property Setters
PropertySetter
Evaluator
KeyFrames
Summary

PART IV

337
338
341

379
380
381
382
392
395
399
402
420

EFFECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421

Chapter 16

Static Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Blur
Motivation
Simple Blur
Gaussian Blur
Performance Trick

www.it-ebooks.info

423
423
426
428
433


xiii

CONTENTS

Reflection
Motivation
Drawing Reflections
Blurred Reflections
Drop Shadows
Motivation
Simple Drop Shadow
Realistic Drop Shadow
Highlights
Motivation
Brightening
Spotlighting
Text Highlighting for Better Readability
Sharpening
Motivation
Simple Sharpen
Unsharp Masking
Sharpening a Downscaled Image
Summary

Chapter 17

434
434
435
435
437
437
438
440
442
442
444
446
448
450
451
452
454
455
458

Dynamic Effects . . . . . . . . . . . . . . . . . . . . . . . . . . .459
Motion
Motivation
Going, Going, Gone
Fading
Motivation
Fading Strategies
AlphaComposite Fading
Color Fading
Cross-Fading
Fading Made Easy
Pulse
Motivation
Feel My Pulse
Automatic Glow
Palpitating Pulse
Spring
Motivation
Spring Fever

www.it-ebooks.info

460
460
462
465
465
467
468
470
472
472
473
473
474
478
482
484
484
486


xiv

CONTENTS

Morphing
Motivation
Morphing Buttons
Summary

Chapter 18

Animated Transitions . . . . . . . . . . . . . . . . . . . . . . . 497
Animating Application State Segues
The Big Idea
Animated Transitions: The Library
Animated Application State
GUI States
The API
Example: SearchTransition
Effects
Example: SearchTransition Revisited: Customization
Example: ImageBrowser
GUI Structure
Pictures and ImageHolder
ScreenTransition
Animated Transitions: Under the Hood, or How
Do You Get Swing to Do That?
Setting Up the Next Screen—Quietly
Getting Layout to Lay Off: Animating Layout Changes
Making Swing Sing: Performance
Summary

Chapter 19

489
489
491
495

497
498
501
501
501
502
503
509
516
519
523
523
525
527
527
528
529
530

Birth of a Filthy Rich Client . . . . . . . . . . . . . . . . . . . 531
Aerith
Running Aerith
Finding Your Way Around
Workflow Paper Design
The Vision
Screen Paper Design
Mockup
From Mockup to Code
Use Layers
Blending Modes
Use Guides

www.it-ebooks.info

531
532
533
533
535
537
538
540
540
542
543


xv

CONTENTS

But . . . I’m Not an Artist!
Choosing Nice Colors
Read Design Books
Summary

544
545
547
548

Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .549
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .553

www.it-ebooks.info


This page intentionally left blank

www.it-ebooks.info


Foreword
T

HIS is a book about creating beautiful applications. Not just blizzards of text
boxes and buttons in some nondescript standard look-and-feel, but applications
that are truly beautiful.

If you wind the clock back enough years, the world of graphical user interfaces
was ruled by standardized look-and-feel specifications. This approach was taken
in an effort to centralize all of the GUI coding in applications, make it easy to
document the applications (everyone knows what a slider does, therefore it doesn’t
need to be described), and work around the relatively poor graphics performance
of desktop computers.
But the last decade’s collision between the computer industry and the consumer
has led to a huge increase in the emphasis on aesthetics in user interfaces: for
everything from brand awareness to increasing the comprehensibility of sophisticated systems, to eye-catching coolness to draw the customer in, to just plain
“Wow!” . . . Aesthetics are in.
Combine this with the phenomenal increase in computer power that Moore’s
Law has brought us, especially as it has been expressed in the performance of
commodity graphics rendering hardware, and you’ve got a huge range of entertaining programming possibilities.
There’s a lot of subtlety in this, from “What makes a beautiful interface?” and
“How do I make the pixels beautiful?” to “How do I make this fast?” This book
covers all of these topics and more. For me, this is the kind of programming task
that counts as pure pleasure. I’m sure it will bring you pleasure, too.
—James Gosling

xvii
www.it-ebooks.info


This page intentionally left blank

www.it-ebooks.info


Preface
W

ELCOME 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.
xix
www.it-ebooks.info


xx

PREFACE

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.

1. Think of it as a GeneralPath to enlightenment.

www.it-ebooks.info


PREFACE

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.

www.it-ebooks.info

xxi


xxii

PREFACE

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
ONLINE

DEMO

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.

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

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.

www.it-ebooks.info


PREFACE

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.

www.it-ebooks.info

xxiii


xxiv

PREFACE

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.

www.it-ebooks.info


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×

×