So for some reason I can't seem to set the background color of a JTabbedPane. This code:

metaTabPane = new JTabbedPane();
metaTabPane.setOpaque(true);
metaTabPane.setBackground(Color.green);

does nothing. The JTabbedPane stays the same grayish-blue default color. What am I doing wrong?

You may want to look at this bug report:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4765247

Depending upon which look and feel you are using, the behavior of the background color for JTabbedPane may vary. I ran across several threads regarding this behavior.

If you only want the content area of the tabbed pane to be a certain color, you can set the background color of the component in that tab (JPanel or whatever) to the desired color.

See this happens though even if I add a tab to the JTabbedPane(). I have made sure to change the background color of the component inside it but the tab itself will not change color. I should have been more clear in my original post. What I'm really looking to do here is to change the color of the Tab.

If you run a search for "JTabbedPane background", you will find others have had the same difficulties. The UI provided by the look and feel you are using may not allow you to change the color of the tab itself. Some have gotten around this by subclassing the UI provided by the look and feel and providing that behavior on their own.

These two threads might help:
http://forum.java.sun.com/thread.jspa?threadID=447837&messageID=3795122
http://forum.java.sun.com/thread.jspa?threadID=461656&messageID=2121255

This article has been dead for over six months. Start a new discussion instead.