Java Code

import java.awt.*;
import javax.swing.*;
public class JTabColors extends JApplet
{
   JTabbedPane tabpane;
   public void init( )
   {
      	// set color for the currently selected tab
	UIManager.put("TabbedPane.selected",new javax.swing.plaf.ColorUIResource(Color.BLUE));
        tabpane = new JTabbedPane( );
	tabpane.addTab( "one", new JLabel( "this is the first one" ) );
	tabpane.addTab( "two", new JLabel( "this is the second one" ) );
	tabpane.addTab( "three", new JLabel( "this is the third one" ) );
	// set the color for each individual tab
	tabpane.setBackgroundAt(0, Color.RED);
	tabpane.setBackgroundAt(1, Color.YELLOW);
	tabpane.setBackgroundAt(2, Color.GREEN);      
	tabpane.setBackground(Color.MAGENTA);
	// set font color for each tab      
	tabpane.setForegroundAt(0, Color.MAGENTA);
	add( tabpane, BorderLayout.CENTER );   
   }
}


© by E.S.Boese. All Rights Reserved