aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes setBackground() problem in 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 "setBackground() problem in a JFrame" Watch "setBackground() problem in a JFrame" New topic
Author

setBackground() problem in a JFrame

Dan Platon
Greenhorn

Joined: Jan 27, 2004
Posts: 4
Hello all !
Here's my problem:
I have a JInternalFrame onto which I draw several components. when this frame initializes it has a grey background color which I want changed into some other. In the internal frame's constructor I use setBackground(Color.WHITE) but it has no effect. I've tried to do this in the constructor of the JPanel which is into the internal frame. Same result.
What am I doing wrong ?
Thanks in advance,
DAN
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

call setBackground() on the contentPane of the JFrame, or call setOpaque( true ) on the contained JPanel to have the background color show up.
[ February 04, 2004: Message edited by: Nathan Pruett ]

-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setBackground() problem in a JFrame