Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Changing an applet background color

 
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?
 
Marshal
Posts: 69539
277
  • 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.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getContentPane().setOpaque(true)?
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic