• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

component colors

 
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
According to Java 2 Certification Study Guide (RHE):
If you do not explicitly set a component's foreground or background color, the component uses the foreground and background color of its immediate container.
I have an applet which contains several panels (navigate using a CardLayout). Each panel contains buttons. I thought that if the buttons were not explicitly assigned a background color, they should use the background color of the panel which contains them. This is not the case, however. I need to set the button background color explicitly to make it match the panel background. (If I do not, the button background defaults to gray). Does anyone know why this is the case?
Thanks in advance.
Stephanie
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
i dont think the component will retain the color of immediate container.for any component,u need to explicitly set the color.
Also as panel is invisible component,and panel is a container for
placing components,the components will not inherit the color.
 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic