Java tutorial
/* Java Swing, 2nd Edition By Marc Loy, Robert Eckstein, Dave Wood, James Elliott, Brian Cole ISBN: 0-596-00408-7 Publisher: O'Reilly */ // SimpleTab.java //A quick test of the JTabbedPane component. // import java.awt.Container; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTabbedPane; public class SimpleTab extends JFrame { JTabbedPane jtp; public SimpleTab() { super("JTabbedPane"); setSize(200, 200); Container contents = getContentPane(); jtp = new JTabbedPane(); jtp.addTab("Tab1", new JLabel("This is Tab One")); jtp.addTab("Tab2", new JButton("This is Tab Two")); jtp.addTab("Tab3", new JCheckBox("This is Tab Three")); contents.add(jtp); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public static void main(String args[]) { new SimpleTab(); } }