I am using Nimbus Look and feel. I needs to change the Background color and foreground color of the tab in JTabbedPane but the color doesn\'t set in JTabbedPane. I tried set
If you want to change the actual content, there are two useful methods of the tabbed pane: setForegroundAt and setBackgroundAt. You can just loop through all the tabs and call these:
for (int i = 0; i < pane.getTabCount(); i++) {
pane.setForegroundAt(i, foregroundColor);
pane.setBackgroundAt(i, backgroundColor);
}
You can also use getComponentAt as well, similarly:
for (int i = 0; i < pane.getTabCount(); i++) {
pane.getComponentAt(i).setForeground(foregroundColor);
pane.getComponentAt(i).setBackground(backgroundColor);
}
The latter approach is more flexible--you can later do more complex things to all the components using code like this.