• Post Reply Bookmark Topic Watch Topic
  • New Topic

background color of a jframe  RSS feed

 
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.

 
Sheriff
Posts: 21325
87
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.
 
Bartender
Posts: 1104
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...
 
Ranch Hand
Posts: 4702
9
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is kind of different and may help or not

 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!