import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; public class SimpleTab extends JFrame { JTabbedPane jtp; public SimpleTab() { super("JTabbedPane"); jtp = new JTabbedPane(); //Add three tabs to the tabbed pane. //All tabs have tooltips and the first also has an icon. jtp.addTab("Tab1", new ImageIcon( "action.gif" ), new JLabel("This is Tab One"), "tab 1" ); jtp.addTab("Tab2", null, new JButton("This is Tab Two"), "tab2" ); jtp.addTab("Tab3", null, new JCheckBox("This is Tab Three"), "tab3" ); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setSize(200, 200); getContentPane().add(jtp); setVisible(true); } public static void main(String args[]) { new SimpleTab(); } }