• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

background color of a jframe

 
doug smith
Greenhorn
Posts: 1
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings All,
I'm having some problems getting the background color to change.


I have a guiClass that extends JFrame and implements ActionListener (once "implements" was spelled correctly). my main program basically just makes a guiClass object.


i have been trying to use setBackground(Color.red); but it is not working. i tried this.setBackground(Color.red) but it didn't work.

I have tried setting the background color in the constructor as well as in a method. Is it something do with JFrame? Am I using the wrong method? any hints as to how I can find out?

this is the last program for a Java class I'm taking at school. I didn't post all my code, since its for a class. I've been able to figure out the rest of the program on my own.

 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the background of the frame's content pane instead.
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is interesting...so, other methods do not delegate like add() was changed...
 
Randall Twede
Ranch Hand
Posts: 4371
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is kind of different and may help or not

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic