Take a look at JXLayer
. It does exactly what you've just asked.
There are some excellent examples by Piet Blok, which have, unfortunately, disappeared off the net. To this end, I've made them available here.
Take a look at the TestWrapped
demo in the pbjar source. It is probably the (among) the best example.
ps - JXLayer
is now officially part of Java 7, known as JLayer