Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing an applet background color

 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble getting the JApplet to change it's background color. I'm using the current OS's "Look and Feel", and try to change the background colour by doing getContentPane().setBackgroundcolor( Color.white) but it refuses to change it.

I have a few JLabels and a few JButtons that are also being drawn with ImageIcon labels that need their background colour to be congruent with the pane's.

I need their background color to be congruent with the pane's background color (white). I'm doing setContentAreaFilled(false); on the buttons to make sure only the ImageIcons are drawn.



Any ideas why this isn't working?
 
Campbell Ritchie
Marshal
Posts: 52590
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't see the content pane. Try changing the colours of the individual components.
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first i want to change the background. Which i am unable to change.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getContentPane().setOpaque(true)?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!