// Create a tabbed pane
JTabbedPane pane = new JTabbedPane();
// Set the text color for all tabs
pane.setForeground(Color.YELLOW);
// Set the background color for all tabs
pane.setBackground(Color.MAGENTA);
// Add a tab
String label = "Tab Label";
pane.addTab(label, component);
// Get index of the new tab
int index = pane.getTabCount()-1;
// Set text color for the new tab
pane.setForegroundAt(index, Color.ORANGE);
// Set background color for the new tab
pane.setBackgroundAt(index, Color.GREEN);
| Related Examples |