Java JTabbedPane using JButton, JCheckBox, JComboBox using applet

import javax.swing.*;
/*
   <applet code = "JTabbedPaneDemo" width=400 height=100>
   </applet>
 */
public class JTabbedPaneDemo extends JApplet
{
    public void init()
    {
        JTabbedPane jtp=new JTabbedPane();
        jtp.addTab("Country",new CountryPanel());
        jtp.addTab("Colors",new ColorsPanel());
        jtp.addTab("Capital",new CapitalPanel());
        getContentPane().add(jtp);
    }
}
class CountryPanel extends JPanel
{
    public CountryPanel()
    {
        JButton b1=new JButton("England");
        add(b1);
        JButton b2=new JButton("Spain");
        add(b2);
        JButton b3=new JButton("Italy");
        add(b3);
        JButton b4=new JButton("Germany");
        add(b4);
    }
}
class ColorsPanel extends JPanel
{
    public ColorsPanel()
    {
        JCheckBox cb1=new JCheckBox("Yellow");
        add(cb1);
        JCheckBox cb2=new JCheckBox("Green");
        add(cb2);
        JCheckBox cb3=new JCheckBox("Orange");
        add(cb3);
        JCheckBox cb4=new JCheckBox("Black");
        add(cb4);
    }
}
class CapitalPanel extends JPanel
{
    public CapitalPanel()
    {
        JComboBox jcb=new JComboBox();
        jcb.addItem("London");
        jcb.addItem("Madrid");
        jcb.addItem("Rome");
        jcb.addItem("Munich");
        add(jcb);
    }
}

Top