Java Code:
import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class TabbedPane1 extends JApplet {
  private String[] flavors = { "Chocolate", "Strawberry",
      "Vanilla Fudge Swirl", "Mint Chip", "Mocha Almond Fudge",
      "Rum Raisin", "Praline Cream", "Mud Pie" };

  private JTabbedPane tabs = new JTabbedPane();

  private JTextField txt = new JTextField(20);

  public void init() {
    for (int i = 0; i < flavors.length; i++)
      tabs.addTab(flavors[i], new JButton("Tabbed pane " + i));
    tabs.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        txt.setText("Tab selected: " + tabs.getSelectedIndex());
      }
    });
    Container cp = getContentPane();
    cp.add(BorderLayout.SOUTH, txt);
    cp.add(tabs);
  }

  public static void main(String[] args) {
    run(new TabbedPane1(), 350, 200);
  }

  public static void run(JApplet applet, int width, int height) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(applet);
    frame.setSize(width, height);
    applet.init();
    applet.start();
    frame.setVisible(true);
  }
}