Java Applet Background Color

  • Thread starter shatner.william
  • Start date
S

shatner.william

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
 
A

Andrew Thompson

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
 
S

shatner.william

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top