Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Java Applet Background Color

Thread view: 
shatner.william@gmail.com - 04 May 2007 20:54 GMT
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 - 05 May 2007 05:21 GMT
...
>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).

Signature

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

shatner.william@gmail.com - 06 May 2007 13:37 GMT
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

> shatner.will...@gmail.com wrote:
>
[quoted text clipped - 29 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200705/1


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.