I’m trying to set the background color of each tab in a JTabbedPane.
Originally, I tried just setting the background color of each Container I was using as a tab (and making all those Containers opaque). This did nothing. Then I found the JTabbedPane.setBackgroundAt method.
My current code is as follows:
for(int iTab = 0; iTab < tabbedPane.getTabCount(); iTab++)
tabbedPane.setBackgroundAt(iTab, tabbedPaneColor);
Nothing happens when the code executes. The tabs are all already created when this code executes, so that’s not the problem. It just doesn’t do anything. Inserting a call to System.err.println prints out “Tab 0”, “Tab 1”, etc., so the calls are being made. It’s like the method just does nothing.
I’m using Java 1.5.