views:

82

answers:

1

I have a group of radio buttons in my Swing application that have a border built around them as follows:

radioButtonPanel.setBorder( new CompoundBorder ( 
    BorderFactory.createTitledBorder( " Input Data " ), padBorder ) );

Our application supports two look and feels, a light and a dark one. When switching between the two, the border color itself appears to change colors correctly, but the text does not. For the life of me, I can't figure out what the name of the component is I should be setting the color of. The documentation for createTitledBorder() says it uses the default look and feel, but I'm unsure where it's pulling its default. I thought it was the Panel.foreground, but that's not it and nothing else seems to look quite right.

Does anybody know which look and feel component I need to be setting here?

+3  A: 

You can set the title colour on a TitledBorder instance or create one using a constructor that takes the title colour as an argument.

The TitledBorder javadoc also states that "TitledBorder.titleColor" property from the look and feel is used as the default. You can override this as follows:

UIManager.getDefaults().set("TitledBorder.titleColor", Color.RED);
Mark
Yep, that's definitely the one. A little annoyed I didn't find that on my own, but absolutely appreciate the help.
Morinar