Home > Default > Change BgColors, FgColors for all Components in a Container?

Change BgColors, FgColors for all Components in a Container?

November 30Hits:0
Advertisement
Is there a possibility to change the Background Color, the Foreground Color and the Fontsettings for all Components in a Container? Each Component in the Container should get the Colorsettings of the Container...

Answers

Just overwrite the add, setBackground(), setForeGround() and the Font-methods of the Container:
public void add(Component c){
super.add(comp);
comp.setBackground(...);
comp.setForeground(...);
//...the Font-stuff
public void setBackground(Color c){
for(int i=0;i< getComponentCount(), ++i){
getComponenetAt(i).setBackground(c);
//the same for setForeground and the Font-methods.

Read other 3 answers

Tags:

Related Articles

  • Change BgColors, FgColors for all Components in a Container?November 30

    Is there a possibility to change the Background Color, the Foreground Color and the Fontsettings for all Components in a Container? Each Component in the Container should get the Colorsettings of the Container...Just overwrite the add, setBackground(

  • Add a border to AWT LabelNovember 30

    I had create a swing JLabel and used the JComponent setBorder() method to create a border. I need to not use swing and stick to AWT. Is there a way I can set the same border on an AWT component? Thanks, ChrisI think I screwed something up. The System

  • Help!!! Need Java Applet to work in IENovember 30

    I found some applets (text scrollers) from the sun site that i wanted to use. downloaded them, but they do not work in IE that does not have JVM. in IE that does have JVM it says 'Java 1.1 Required' where the applet should be. is there a simple way t

  • Swing components in applet not working in web browserOctober 11

    Hi Guys, I've created an applet which makes use of some swing components, but unfortunately, not all of them function properly in my web browser (internet explorer or Mozilla Firefox). Its mainly the buttons; the last buttons works and displays the c

  • How the refer the HTML components name or property.October 11

    Hi guys, My doubt is on STRUTS, if this is not correct forum to ask the questions in struts pls redirect me to the correct forum. i am very new to struts....... my question is , we are using lot of components like text, button and radio in the jsp fi

  • Programmed(AS3) components of swf do not display in browserOctober 11

    Hi friends, I am new to Flash and tools, however I have searched Internet, tried various suggestions for flash embed before posting the question here. The issue is that swf plays in Flash Player but when I view html (generated by Flash Professional C

  • Avoid repaint in JLayeredPane componentsNovember 30

    I have a program including a JLayeredPane that contains a JComponent and a JPanel. Both components are set on different layers of the JLayeredPane. I use the JPanel for painting, so I want to avoid unnecessary repaints if I can. The problem is that w

  • Alarm status drawing iow: recolour JInternalFrame componentsOctober 11

    Greetings, Please have a look at this picture. It's a low res snapshot of a few quite complicated components. Most of the functionality isn't visible nor relevant in the example. What you're looking at is a real time process of some sort. Things can

  • DID YOU KNOW?? - ABOUT ADVANCED COMPONENTS IN THE PALETTE??October 11

    <br> Hi All, DID YOU KNOW?? The IDE ships with the following Advanced Components in the Palette. These advanced components are a set of JavaServer Page markup tags for advanced users. The components have no visual appearance and are useful to develo

  • DID YOU KNOW?? - ABOUT DATAPROVIDER COMPONENTS IN THE PALETTE??October 11

    Hi All, DID YOU KNOW?? Practically all applications entail accessing data of some sort, often data stored in a relational database table or some sort of list, such as a vector or an array. Usually you need to read in data from the data source, but ma

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.560 s.