Recursive background color working except for jcombobox & jbutton

I'll start this as I usually do: I probably missing somethign obvious but...
I am trying to setup a gui where all of a JFrames child components change background and foreground color. It seems to be working fine except for my JCombobox (the currently selected item background, not the pulldown), my button backgrounds, my checkbox boxes, and my radio button circles. (all of these are appearing as white) (code below)
My suspicion is that I'll need to bail on this approach and look into making a custom laf. I have a strong suspicion that if at all possible, I don't want to go down that route: Is there any way I can make this approach work?
//this is code in my custom JFrame subclass
public void setComponentsColor ( Color foreColor, Color backColor ) {     
     setContainersComponentsBackground( this.getContentPane(), foreColor, backColor );
protected void setContainersComponentsBackground ( Container container, Color foreColor, Color backColor  ) {
     Component [] array = container.getComponents();
     for( int i = 0; i < array.length; i++ ) {
          array.setBackground( backColor );
          array[i].setForeground( foreColor );
//test to see if it is a container
          if( Container.class.isAssignableFrom( array[i].getClass()) ) {
               setContainersComponentsBackground( (Container)(array[i]), foreColor, backColor );
thanks all
-sss

So to be clearTo be clear you should include code the demonstates the incorrect behaviour. When I run the following code the North combobox is red and the South combobox is blue. It doesn't matter whether the dropdown is visible or not.
import java.awt.*;
import javax.swing.*;
public class ComboBoxTemp extends JFrame
    public ComboBoxTemp()
        String[] items = { "a", "b", "c" };
        JComboBox comboBox1 = new JComboBox( items );
        comboBox1.setBackground( Color.red );
        comboBox1.setForeground( Color.white );
        getContentPane().add( comboBox1, BorderLayout.NORTH );
        JComboBox comboBox2 = new JComboBox( items );
        comboBox2.setEditable( true );
        comboBox2.getEditor().getEditorComponent().setBackground(Color.blue);
        comboBox2.getEditor().getEditorComponent().setForeground(Color.white);
        comboBox2.setBackground( Color.blue );
        comboBox2.setForeground( Color.white );
        getContentPane().add( comboBox2, BorderLayout.SOUTH );
    public static void main(String[] args)
        ComboBoxTemp frame = new ComboBoxTemp();
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.pack();
        frame.setLocationRelativeTo( null );
        frame.setVisible( true );
}

Similar Messages

  • HT201406 IOS7 installed OK to my iPhone 4S and worked OK for a while but I have somehow managed to completely jam my iPhone 4s. The touch screen won't work except for up and down gestures (some of the time). I can't make or answer calls, I can't even powe

    IOS7 installed OK to my iPhone 4S and worked OK for a while but I have somehow managed to completely jam my iPhone 4s. The touch screen won't work except for up and down gestures (some of the time). I can't make or answer calls, I can't even power if off. I can't access the hardward ID which Apple support seems to require for Chat.
    It might have happened when I was accessing my camera bypassing the lock screen!
    All I know is that the thing is now useless and it looks like I will have to wait for the battery to run down to see if powering it back up afterwards will solve the problem.

    I have since discovered the "hold down home key and power button" together for a few seconds and this seems to have worked .... phew!

  • I just migrate settings and software from my PowerBook to a new Mac Pro. All the software download from CC is there and working, except for CC, and there is not way to install.

    I just migrate settings and software, include CC, from my PowerBook to a new Mac Pro. All the software download from CC is there and working, except for CC, and there is not way to install. I have try because every time I restar keep bothering asking for installation, (by the way, the link is not up to date). Will appreciate your help.

    never migrate adobe software.  it should be properly installed.
    uninstall all the cc programs you can, clean and then reinstall per, Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6

  • I had photoshop installed fine.  We had to replace our hard drive, but had a full backup and everything else is working except for elements.  This is the message I get -Some of the application components are missing from the Application directory, Please

    I had photoshop installed fine.  We had to replace our hard drive, but had a full backup and everything else is working except for elements.  This is the message I get -Some of the application components are missing from the Application directory, Please reinstall the application.  I have reinstalled, but am getting the same message.

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.org/kb/Bookmarks+not+saved#w_fix-the-bookmarks-file
    You can also try to repair the places database with this extension:
    *https://addons.mozilla.org/firefox/addon/places-maintenance/

  • I have windows vista. I have run the latest update from Microsoft. iTunes works except for connecting to the store. I have tried everything on line for suggestions. Nothing works.....please HELP!

    I have windows vista. I have run the latest update from Microsoft. iTunes works except for connecting to the store. I have tried everything on line for suggestions, going back on the update, allowing through in firewall settings, adding to trusted sites, disabling bonjour...Nothing works.....please HELP!

    I have also uninstalled and reinstalled iTunes

  • I reinstalled Firefox and used Xmarks to reinstall bookmarks. All work except for those in the bookmarks toolbar, which scroll down but don't open the page when clicked.

    I did a clean install of XP and reinstalled Firefox. Then I used Xmarks to get back all my bookmarks. All are working except for the bookmarks toolbar. It shows entries and scroll as normal but when I click on one the page doesn't open.

    I can't install xmarks for firefox

  • I have set up all my mac devices to sync with iCloud and all work except for email. When I delete on one device, the delete doesn't occur on the other devices.

    I have set up all my mac devices to sync with iCloud and all applications work except for email. Incoming messages appear on all devices but when I delete on one device, the delete doesn't occur on the other devices.

    Thank you for your interest. I use apple mail to access my two accounts -I guess they are 3rd party accounts. One is a gmail acount and the other is a bigpond account. I admit to a lack of a high level of literacy when it comes to the language around all of this. For example, I am aware that I have an iCloud email account as I managed to set it up, but don't really understand the purpose of it as the last thing I need is yet another email account to oversee.

  • Phone went through wash and everthing is now working except for the data.  Phone keeps searching...

    My phone went throught the wash and everything is now working except for the data.  It keeps searching...

    You can try getting a new microSIM for it. How long did you let it dry?

  • Dropped my iPhone in a pool. Everything works except for sound.. What should I do?

    Dropped my iPhone in a pool. Everything works except for sound.. What should I do?

    Turn it off and put it in a bag of rice for 5-7 days.  You might get lucky but I wouldn't count on it.
    You should have turned it off immediately and put it in rice but since you used it after getting wet, your chances are very slim.

  • I just recently installed mountain lion and an update for SMC firmware to install power nap. Everything is working except for the menu bar, the icons native to the system do not respond, and features like the clock and battery meter freeze.

    I just recently installed mountain lion and an update for SMC firmware to install power nap. Everything is working except for the menu bar, the icons native to the system do not respond, and features like the clock and battery meter freeze.
    When I mouse over the icons, the rainbow appears as if it was processing something. The problem is eliminated when I restart my computer but it comes back after a while.
    I guess I cant make a backup copy and restore the whole disk because the copy would be made with this error.
    Can anyone help me? Anyone with the same issue?

    Update: I was able to test out the HDMI adapter as well and the same issue occured.  I'm stumped.  10.8.1 maybe.

  • My iPod screen got broken and some water got on it! The screen has gotten darker due to the moisture but otherwise the iPod still works except for the sound! I have no sound anymore! What can I do?

    My iPod screen got broken and some water got on it! The screen has gotten darker due to the moisture but otherwise the iPod still works except for the sound! I have no sound anymore! What can I do? Pleas help!

    1. Nothing and live with it
    2. Apple will exchange your iPod for a refurbished one for $99 for 16 GB 5G and $149 for the other 5Gs. They do not fix yours.
      Apple - iPod Repair price

  • AFP Home Directories Working - Except for...

    Hello. I have a test model for a network environment I am preparing to deploy. AFP is working - for the most part - properly and as expected in providing a network home for open directory users.
    However I have three issues I have run into and still can't find the reasoning.
    1) When creating a new home folder in the workgroup manager I get the error below. However it still creates the home and functions - for the most part - properly. This could be connected to any of the below two issues.
    +Error of type Not a known DirStatus (-1) on line 2112 of /SourceCache/WorkgroupManager/WorkgroupManager-319.2.2/Plugins/UserAccounts/Use rAdvancedPluginView.mm+
    2) When viewing the home folder in the finder it doesn't appear that home folder disc quotas are applying correctly. In the guest machine home folder it shows "9 items 26GB Available" at the bottom while the quota is set for 5GB per user.
    3) Write and read (saving files) is working for all applications except for iWeb. About half way through a publish to a folder in iWeb it fails the publish very with a this disk is unwritable error. However it gets many of the files published before it finally fails. Sometimes, but not all times the AFP connection will drop completely and it will come up with an OS "server disconnected" dialogue box.
    Looking at the AFP access log it shows the following hundreds and hundreds of time - probably about 700 or so times repeated. The error log shows no errors. It seems like it is just overloading the server somehow?
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:52 -0500] "Reconnected User: testuser7" 501 0 0+
    +<Connection> - - [22/Nov/2008:20:02:52 -0500] "Saved for Reconnect User: testuser7" 1227390615 503 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:52 -0500] "Login testuser7" 0 0 0+
    +** - - [22/Nov/2008:20:02:52 -0500] "<D> testuser7" 89 503 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:52 -0500] "Reconnected User: testuser7" 503 0 0+
    +<Connection> - - [22/Nov/2008:20:02:53 -0500] "Saved for Reconnect User: testuser7" 1227390615 505 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:53 -0500] "Login testuser7" 0 0 0+
    +** - - [22/Nov/2008:20:02:53 -0500] "<D> testuser7" 89 505 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:53 -0500] "Reconnected User: testuser7" 505 0 0+
    +<Connection> - - [22/Nov/2008:20:02:53 -0500] "Saved for Reconnect User: testuser7" 1227390615 507 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:53 -0500] "Login testuser7" 0 0 0+
    +** - - [22/Nov/2008:20:02:53 -0500] "<D> testuser7" 89 507 0+
    +IP fe80::21c:42ff:fe7d:1638 - - [22/Nov/2008:20:02:53 -0500] "Reconnected User: testuser7" 507 0 0+
    +<Connection> - - [22/Nov/2008:20:02:53 -0500] "Saved for Reconnect User: testuser7" 1227390615 509 0+
    Thanks so incredibly much for any suggestions or ideas.
    ~ Ben

    Parallels Issue. Track at http://forum.parallels.com/showthread.php?p=135585

  • All internet working except for Safari

    Hi,
    All of my applications that use internet connection are working fine except for Safari. The blue bar just sits very near the begining and nothing much happens at all.
    I tried to clear cache, history and cookies with no success.
    Thanks for any help.

    Hi,
    I have since found that all of a sudden it is working again. I didn't do anything except I removed one application (Wifi Finder) for other reasons.
    BTW, I use my wireless router with several other devices and all of these were working fine.
    Also, on my touch, I have the Twitter app, and when i click on a URL within a Twitter message, it opened the page within the Twitter app (I guess it uses a built-in browser). It was just Safari that was failing.
    Anyway.... it is working now, but I have no idea what happened.
    Thanks anyway.

  • ITunes download said I needed to uninstall first. Followed instructions on how to uninstall. Everything worked except for iTunes itself and it won't uninstall but won't install either. Help!

    I followed the instructions for the uninstall as found on the website, but all of the software except for iTunes uninstalled successfully. Now it won't uninstall and the updated version won't instal either and I have no idea what to do. I'm very frustrated at this point as I've tried everything on the support website.

    Perfect, thanks.
    "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330."
    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • Background color change option for box in screen painter

    have created a box in screen painter . is there any option to change the back ground color of this box.
    please help

    No, you can not change the background color of your screen painter box.

Maybe you are looking for

  • My iOS 4.2.1 cannot upgrade any farther. How can I use TuneIn Radio type of apps which appear to require iOS 4.3 or higher?

    Can I use any Radio apps such as TuneIn or I Heart Radio with iOS 4.2.1. These and other radio apps such as Pandora each state that I must have iOS 4.3 or higher. Apple says my device cannot run any iOS higher than 4.2.1.

  • Plz help me in finding out the BADI or menu exit for IW32

    HI in Tcode IW32, based on the user status(ASTTX), the menu items ,EXTRAS -> TASK LIST SELECTION -> all items have to be grayed out. Please help me to find out BADI or menu exit which ever is available. Thanks, Pallavi.

  • Using current dimmensions for new business areas with coarser granularity

    Hi, I have a time dimension which has month, quarter, semester and year attributes. I am creating a new business area in which each fact refers to a quarter (we have no monthly data). In this case I am considering two options: 1) Using an attribute i

  • Cfmail

    when i send mail using cfmail and under cfmail i add this cfmailpart tag...... after i add this cfmailpart tag..if will automatically attach an empty .txt file...... how to solve it???? thx to answer my question

  • 32bit library on solaris64

    I am a novice on solaris and i am trying to install a 32bit application on a T2000 Sun server that has Solaris10 64bit preinstalled. An error about not finding the library lib sunmath.so.1 appeared and when i copied the library this error appeared: w