Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet BackGround

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to set up the background color of an applet ? Default is skycolor. If I want to change to white. Which method I have to use for it? Plz explain by syntax
Thanks in advance,
angela
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angela,
This little applet demonstrates changing the background color from skycolor to white and back.

Hope this helps.
Stephanie
 
usman ahmad
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

OR

In the paint() method you can use like this
<pre>
public void paint(Graphics g)
{
setbackground(Color.anycolor);
}
</pre>
Where anycolor can be white,red,blue etc.
I hope this will be helful too.
Regards,
Usman
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Usman,
Angela
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic