Drag n' Splash Swing Demo

Update: I fixed two bugs and reduce the size of the window to speed up the effect.

Video: You can watch a video. Windows only, I'm sorry guys but the codec used for recording does not work well on my computer.

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

Being able to drag and drop files from the host environment to a Java application is really useful. Unfortunately we must suffer from the sight of these ugly Windows mouse drag and drop cursors. When playing with Dashboard on my PowerBook I had the idea of showing a splash when something is dropped onto a Swing application. Note this is interesting only when the dropped element is meant to visually appear at the place where you dropped it. I built a nice Swing application onto which you can drag and drop image files:

Every time you drop a file, and please use only JPEG and PNG pictures, a shadowed thumbnail appears in the window. Not really exciting so far. The cool thing happens when you stack pictures or drop them next to each other. You'll see a cool ripple beneath the new picture. The effect is really slow (or blazingly fast, depending on your computer) because I used some very very old code which I can't understand anymore so I have no way to easily control the speed and the length of the effect ^^ Generally speaking the code of this demo is just awful and sub-optimized (and I really mean it, take a look :).

Below are two screenshots of the effect in action. It looks very subtle on these images but it is much much better in live. Just try out the web start demo!

Comments are closed.