Changing the JTabbedPane BG color

From: blue (fluyckx_at_configsc.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 15:50:04 -0500

Hi there,

i have a question that has been around for sometime now, and i guess it has
to do with the operating system,
i'm running windows XP service pack 2. Anyways, the problem that i'm having
is with the JTabbedPane. When u select a
a tab i want to change the background color of the selected tab. I have
already tried all of these:-
UIManager.put("TabbedPane.selected", newColor);
UIManager.put("TabbedPane.highlight", newColor);
UIManager.put("TabbedPane.focus", newColor);
UIManager.put("TabbedPane.selectHighlight", newColor);

mytabpane.invalidate();
mytabpane.validate();
mytabpane.updateUI();

mytabpane.setBackgroundAt(newColor);

none of these is workin', any help is highly appreciated, here is a snippet
from my code..........

for( int i = 0; i < configtabpane.getTabCount(); i++ )
         {
         if( i == configtabpane.getSelectedIndex() ){
           configtabpane.setBackgroundAt(i,UITools.getColor(
this.applet.getAA().getActiveTabColor(), "lightgray" ));
           /*UIManager.put("TabbedPane.contentBorderInsets",
               new InsetsUIResource(1, 1, 2, 2));
           UIManager.put("TabbedPane.tabAreaInsets",
               new InsetsUIResource(1, 1, 2, 2));*/

           UIManager.put("TabbedPane.selected",new
ColorUIResource(UITools.getColor(this.applet.getAA().getActiveTabColor())));
           UIManager.put("TabbedPane.selectHighlight",new
ColorUIResource(UITools.getColor(this.applet.getAA().getActiveTabColor())));
           UIManager.put("TabbedPane.tabAreaColor",new
ColorUIResource(UITools.getColor(this.applet.getAA().getActiveTabColor())));
           configtabpane.invalidate();
           configtabpane.validate();
           configtabpane.updateUI();

           //System.out.println("configtabpane.getBackgroundAt(i) =
"+configtabpane.getBackgroundAt(i));

         }
         else
           configtabpane.setForegroundAt(i,
this.componentPanelList[i].getFGColor());
         }

We aren't having any problems with Win2k or WinXP SP1, seems to be only SP2.

Any suggestions?

Thanks,
Frank