• Post Reply Bookmark Topic Watch Topic
  • New Topic

backgrounf Color of a Container

 
Vipul Tangri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
How can i change the backgroung color of a container?
for example, for a frame .....
Frame f= new myFrame();
f.setBackground(color.green);
then why doesn't the color of a container change?
Guide me, with an example, if u can.....

thank u.....
vipul
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
it should work, provided you have written Color.green instead of color.green. Here is one code I compiled and ran:
<code>
import java.awt.*;
class test extends Frame{
test3()
{
setSize(300,300);
setVisible(true);
}
public static void main(String args[]) {
Frame f=new test();
f.setBackground(Color.green);
}
</code>
Tanveer
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!