This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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: 66208
250
  • 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)?
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!