Java tutorial
import java.awt.Color; import java.awt.Container; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; public class Main { public static void main(String[] args) { Container c1 = new GradientPanel(); Container c2 = new GradientPanel(); JTabbedPane top = new JTabbedPane(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); top = new JTabbedPane(JTabbedPane.TOP); top.addTab("1", c1); top.addTab("2", c2); frame.add(top); frame.pack(); frame.setVisible(true); } } class GradientPanel extends JPanel { public GradientPanel() { this.add(new JLabel("Here")); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; GradientPaint p = new GradientPaint(0, 0, Color.white, getWidth(), getHeight(), Color.gray); g2d.setPaint(p); g2d.fillRect(0, 0, getWidth(), getHeight()); } }