Program For JTabbedPane In Java-----------
import javax.swing.*;
import javax.swing.JTabbedPane;
/*<applet code="JTDemo" width=400 height=300></applet>*/
public class JTDemo extends JApplet
{
public void init()
{
JTabbedPane jtp=new JTabbedPane();
jtp.addTab("News Papers",new nwsPanel());
jtp.addTab("Magazines",new magPanel());
jtp.addTab("websites",new webPanel());
getContentPane().add(jtp);
}
}
class nwsPanel extends JPanel
{
public nwsPanel()
{
JButton b1=new JButton("Indian Express");
add(b1);
JButton b2=new JButton("Times of India");
add(b2);
JButton b3=new JButton("Sakal");
add(b3);
JButton b4=new JButton("Lokmat");
add(b4);
}
}
class magPanel extends JPanel
{
public magPanel()
{
JCheckBox jcb1=new JCheckBox("Indian Today");
add(jcb1);
JCheckBox jcb2=new JCheckBox("Review");
add(jcb2);
JCheckBox jcb3=new JCheckBox("Policy Diary");
add(jcb3);
}
}
class webPanel extends JPanel
{
public webPanel()
{
JComboBox cb1=new JComboBox();
cb1.addItem("google.com");
cb1.addItem("yahoo.com");
cb1.addItem("mns.com");
add(cb1);
}
}
import javax.swing.*;
import javax.swing.JTabbedPane;
/*<applet code="JTDemo" width=400 height=300></applet>*/
public class JTDemo extends JApplet
{
public void init()
{
JTabbedPane jtp=new JTabbedPane();
jtp.addTab("News Papers",new nwsPanel());
jtp.addTab("Magazines",new magPanel());
jtp.addTab("websites",new webPanel());
getContentPane().add(jtp);
}
}
class nwsPanel extends JPanel
{
public nwsPanel()
{
JButton b1=new JButton("Indian Express");
add(b1);
JButton b2=new JButton("Times of India");
add(b2);
JButton b3=new JButton("Sakal");
add(b3);
JButton b4=new JButton("Lokmat");
add(b4);
}
}
class magPanel extends JPanel
{
public magPanel()
{
JCheckBox jcb1=new JCheckBox("Indian Today");
add(jcb1);
JCheckBox jcb2=new JCheckBox("Review");
add(jcb2);
JCheckBox jcb3=new JCheckBox("Policy Diary");
add(jcb3);
}
}
class webPanel extends JPanel
{
public webPanel()
{
JComboBox cb1=new JComboBox();
cb1.addItem("google.com");
cb1.addItem("yahoo.com");
cb1.addItem("mns.com");
add(cb1);
}
}
No comments:
Post a Comment