Shadowed Splash Window

You can run the WebStart demo or, as usual, download its source code.

Ok, this is not a really innovative effect but I wanted to implement it since I first saw the java.awt.Robot class. It took me years but I finally made it :) Anyway, the ShadowedWindow class lets you display a splash screen with a shadow beneath. The shadow appears to be cast on your desktop. The trick, as you may know, is to grab a part of the screen with Robot and to draw the splash screen upon the capture. This approach is easy to implement and quite efficient but you don't want to use it when your splash screen remains a long time on the screen. Since a “screenshot” is performed, the splash cannot reflect the changes happening behind it.

This is really a first attempt. I'm still playing with the distance, the blur, the transparency and the shape of the shadow. The shadow shown here is 4 pixels far from the splash, with 30% of transparency and uses a rectangular shape. I tried with a rounded rectangle and the result seems a little better. If I end up adding this to SwingFX, I'll propbably allow the programmer to customize all these properties anyway :)

Comments are closed.