javacssapplettransparencywmode

How can I set a Java applet transparency to show contents behind it?


I've got a web page with an applet inside. This applet is a drop target on a drag and drop action from the OS, I simply take an image from a folder, drag it on the applet and something happens.

I give this webpage to a graphic designer and he ask to if he can put an image behind the java applet so he can simulate to change the background using CSS (it is a skinned app and graphic design can change during execution).

Practically i supposed to do:

<div>
    <applet width="50" height="50" />
</div>

with this CSS:

div {
    width:50px;
    height:50px;
    background-image: url(image.jpg) center center no-repeat;
}

But it doesn't work (background is opaque).

It is possible to set transparency to the applet without loosing drag and drop capabilities ?

I'm searching something similar to flash wmode parameter.

Better solutions implies only changes on the CSS/HTML without recompiling java class so the designing team can change the page structure without changing the Java.


Solution

  • You might pass the background image URL into the applet as a parameter, or have the applet use Javascript to interrogate the page to determine what background image is shown.