Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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: 21458
96
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

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!