
Blur Disabled Components #9
Chapter 1, Basic JComponents
|
39
HACK
with each frame. For the second half of the animation, it shrinks and moves
to the right, making it appear to fade into nothing. Once the blind is calcu-
lated,
VenetianPane
draws the blind multiple times to cover the entire tab
content area, creating the effect seen in Figure 1-25.
This hack is quite extensible. With the power of Java2D you could add
translucency, blurs, OS X-like genie effects, or anything else you can dream
up. As a future enhancement, you could include more animation settings to
control the frame rate and transition time. If you do create more, please post
them on the Web for others to share.
H A C K
#9
Blur Disabled Components Hack #9
This hack explores creating how to perform a blur transformation on a Swing
component.
Every Swing component draws to the screen via the paintComponent( )
method. This is true even for components that offload the actual drawing to
Look and Feel UI objects. Because all drawing goes through the
paintComponent( ) method at some point, this point is where you can do
some interesting things by manipulating the graphics object during the paint
process.
Swing components draw to the
Graphics object passed in through the
paintComponent( ) method. This means that if you replace the Graphics
object with a custom version, you can capture a component’s drawing into a
bitmap instead of going straight to ...