How do I get my applet to have the same background (image) as my web page?
Created May 4, 2012
All the others set the default background (which is inherited by all the applet's child windows, unless explicitly overridden) to a grey tone. There's also not great consistency between different browsers as to what this grey shall be (particularly in 8-bit mode).
So you need to do two things:
1. get the color of the webpage background. I assume
there's a way (via LiveConnect) to inspect the
document object's settings, but as you can't count on
LiveConnect being present on all platforms, you need to
pass the color as an explicit parameter to the applet.
2. set the background color of the applet yourself with
the color you obtained from the parameter.
In the init() method of your applet, call setBackground().
As color settings propagate through the widget instance
tree, any decendant of this widget should also get the
same background color.
You might like also to do the above procedure with the foreground color you want the applet to have. But, you can't make the applet background transparent.