Java Applet Background Color  
Author Message
shatner.william





PostPosted: 2007-5-5 3:55:00 Top

java-programmer, Java Applet Background Color Hi,

I am trying to set the background color of my applet to white but it
keeps coming up gray.Strangely when I open the applet on a local web
page (not live on the web), applet viewer (thru eclipse) or even live
on the web from my own home PC it appears white as expected. But from
every other machine that I access it the background is grey. Even when
i run it thru Eclips on other PCs the background is gray.I have tried
to set the background to white by calling

setBackground(Color.white)
and
setBackground(Color.WHITE)

from the init() method. In the HTML that calls the applet i also set
the <body bgcolor=#FFFF></body> and i do the same for the <HEAD>.
However from every other machine that I access my webpage/applet
except my own home PC the background still appears as gray.

Any ideas?

Thanks
WS

 
Andrew Thompson





PostPosted: 2007-5-5 12:22:00 Top

java-programmer >> Java Applet Background Color email***@***.com wrote:
..
>I am trying to set the background color of my applet to white but it
>keeps coming up gray.

Is it AWT or Swing? If Swing - have you set
the stransparency false? What is the PLAF?....
All this could be answered with an URL to the page
(live) whith said page linking to the code.

>setBackground(Color.white)
>and
>setBackground(Color.WHITE)

What minimum Java version is your applet targetted to support?

>from the init() method. In the HTML that calls the applet i also set
>the <body bgcolor=#FFFF></body> and i do the same for the <HEAD>.

Neither of those will have any good effect, since the
root component of any applet is opaque (no see through)

>Any ideas?

Answer the questions above, and change your posting ID
from that of the star trek actor (are my ideas).

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200705/1

 
shatner.william





PostPosted: 2007-5-6 20:37:00 Top

java-programmer >> Java Applet Background Color Hi Andrew,

Thanks for your reply. I had to change my content pane, I had it set
as a JPanel and I changed this to Container.
Then I called contentPane.setBackground(Color.white) rather than just
setBackground(...)and it worked.

Container contentPane = getContentPane();
contentPane.setBackground(Color.white);

Thanks again for taking the time to reply.


Cheers,
Toriacht


On May 5, 5:21 am, "Andrew Thompson" <u32984@uwe> wrote:
> email***@***.com wrote:
>
> ..
>
> >I am trying to set the background color of my applet to white but it
> >keeps coming up gray.
>
> Is it AWT or Swing? If Swing - have you set
> the stransparency false? What is the PLAF?....
> All this could be answered with an URL to the page
> (live) whith said page linking to the code.
>
> >setBackground(Color.white)
> >and
> >setBackground(Color.WHITE)
>
> What minimum Java version is your applet targetted to support?
>
> >from the init() method. In the HTML that calls the applet i also set
> >the <body bgcolor=#FFFF></body> and i do the same for the <HEAD>.
>
> Neither of those will have any good effect, since the
> root component of any applet is opaque (no see through)
>
> >Any ideas?
>
> Answer the questions above, and change your posting ID
> from that of the star trek actor (are my ideas).
>
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200705/1