Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setBackground() problem in a JFrame

 
Dan Platon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic