Iam trying to write a small program to create a labelfield and a
tabbed panel in Swing.Iam getting errors in the addTab method can
somebody help me?
import javax.swing.* ;
import java.awt.*;
import java.awt.event.*;
public class sScreen extends JApplet
{
public sScreen()
{
Container contentPane = getContentPane();
JPanel panel1 = new JPanel();
panel1.add(new JLabel("Hi M"));
JTabbedPane tabbedPane = new JTabbedPane();
JPanel jpanel1 = new JPanel();
JPanel jpanel2 = new JPanel();
JPanel jpanel3 = new JPanel();
JPanel jpanel4 = new JPanel();
JPanel jpanel5 = new JPanel();
JPanel jpanel6 = new JPanel();
jpanel1.add(new JLabel("This is Student Registeration"));
jpanel2.add(new JLabel("This is Student Accounts"));
jpanel3.add(new JLabel("This is Student Records"));
jpanel4.add(new JLabel("This is Personal Information"));
jpanel5.add(new JLabel("This is Logout"));
tabbedpane.addTab("Registeration", jpanel1);
tabbedpane.addTab("Student Accounts",jpanel2);
tabbedpane.addTab("Student Records",jpanel3);
tabbedpane.addTab("Personal Information",jpanel4);
tabbedpane.addTab("Logout",jpanel5);
contentPane.setLayout(new BorderLayout());
contentPane.add(panel1);
contentPane.add(tabbedpane);
}
public static void main(String[] args)
{
JFrame frame = new JFrame("sScreen");
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
frame.getContentPane().add(new sScreen(),
BorderLayout.CENTER);
frame.setSize(400, 600);
frame.setVisible(true);
}
}