This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes background color of a jframe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "background color of a jframe" Watch "background color of a jframe" New topic

background color of a jframe

doug smith

Joined: Aug 13, 2010
Posts: 1

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(; but it is not working. i tried this.setBackground( 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

Joined: Oct 27, 2005
Posts: 19656

Try setting the background of the frame's content pane instead.

How To Ask Questions How To Answer Questions
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1076

This is, other methods do not delegate like add() was changed...

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340

this is kind of different and may help or not

Visit my download page
I agree. Here's the link:
subject: background color of a jframe
Similar Threads
GUI number guessing game program
changing background color of JFrame
swing questions
Background color change help
identifier expected errors :(