Keilly: Creating a Swing Dashboard Widget - Part 7 (Moving)

Tuesday, June 3, 2008

Creating a Swing Dashboard Widget - Part 7 (Moving)

Widgets can be moved around by clicking almost anywhere their surface and dragging.
OSX provides this by default when the window decoration is turned off. On Windows a mouse listener has to be attached directly to the widget, and some simple repositioning code added.

With this, and some other tidying up, a demo of progress up till now is possible.

Remember you'll need the Java 6 update 10 for this to work properly. Anything less certainly won't do the transparency and will look poor.

OSX will run it but, as there's no Java 6 update 10 to try, you'll see bad transparency rendering issues (still worth a look though). I still hope the transparency can be fixed without using an additional external library.
Also the font alignment is frustratingly different on different platforms, making the 'Done' and 'i' text buttons look poor on OSX, but this will be fixed [at the cost of writing more code].

Launch Demo

No comments: