aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "background color of a jframe" Watch "background color of a jframe" New topic
Author

background color of a jframe

doug smith
Greenhorn

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(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

Joined: Oct 27, 2005
Posts: 19718
    
  20

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129


http://www.dreamincode.net/forums/topic/59010-cant-set-jframe-background-color/
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1085
    
  10

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


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

this is kind of different and may help or not



SCJP
Visit my download page
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: background color of a jframe