Showing posts with label dialog. Show all posts
Showing posts with label dialog. Show all posts

Thursday, January 14, 2010

DialogWithDropShadow +JXLayer use case

The drop shadow dialog/frame from the last article is indeed not something to use everywhere.
There is one situation although I like to use it:



While opening a dialog over a JFrame, a gray filter is applied over the JFrame using JXLayer, the gray filter is of course faded in using a fast animation (500ms => the same time it take for the dialogWithDropShadow to fade in). I really like the result, it makes the dialog really stand out, and make the user focus on it.
Launch the web start demo to see the animation.

The fade in of the gray filter is done by animating the alpha property in the ColorLayerUI class.
This ColorLayerUI is really simple; it’s just paint a grey rectangle in the paintLayer method.