In nine fairly simple steps we've gone from a blue square:

...to a nice looking widget that hopefully looks at home on the modern Desktop:

The only shortcut I took was not to pull out the maths book and write my own transform filter.
I'm very pleased with the result, it was a lot easier than I thought it would be. Hopefully this exercise proves (again) that Swing can be more than just a boring, gray, toolkit suitable for boring, gray, form-filling applications.
The new transparency features especially allow vibrant, modern looking UI's that are relatively simple and quick to create.
So that's really it for the UI.
A few non-UI remarks...
Java widgets have a number of benefits over other widgets systems:
- No framework or widget manager needed
- Platform independent
- Installed from a web-page
- The extensive JDK library available as standard
- Sandboxed and secure automatically
- Familiar language with powerful UI toolkit
- Customizable, fast, accelerated painting (try that in Javascript)
There are still a few non-UI things to do before making this code truly useful: preferences and desktop startup spring immediately to mind.
Performance is also an issue. On my machine the two widgets take about 20 MB of RAM each and 0 CPU cycles when just sitting there. 20MB is considerably more than a simple Widget in Apple's Dashboard for example.
However, in modern machines with RAMs of 1GB+ as standard, and depending who you're asking, maybe this is an increasingly unimportant issue. Especially if the widget is useful.
Feel free to use the Source Code. Don't forget you'll need the filters classes from JHLabs.
Source Code Download