File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setBackground() problem in a JFrame" Watch "setBackground() problem in a JFrame" New topic

setBackground() problem in a JFrame

Dan Platon

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,
Nathan Pruett

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 ]

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: setBackground() problem in a JFrame
It's not a secret anymore!