Setting the Color of a Tab in a JTabbedPane Container
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JTabbedPane;
public class Main {
public static void main(String[] argv) throws Exception {
JTabbedPane pane = new JTabbedPane();
pane.setForeground(Color.YELLOW);
pane.setBackground(Color.MAGENTA);
String label = "Tab Label";
pane.addTab(label, new JButton("Button"));
int index = pane.getTabCount() - 1;
pane.setForegroundAt(index, Color.ORANGE);
pane.setBackgroundAt(index, Color.GREEN);
}
}
Related examples in the same category