I have a simple java applet,but the panel is not appearing even after adding it,i have set the gridlayout for the panel and the the default layout for Jpanel.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//<applet code="vote.class" width=400 height=200></applet>
public class vote extends JApplet implements ActionListener
{
JLabel l1,l2,l3;
JButton b1,b2,b3;
JPanel mp;
Panel p1,p2;
public void init()
{
this.setLayout(null);
mp=new JPanel();
//mp.setLayout(null);
Panel p1=new Panel();
p1.setLayout(null);
p1.setLayout(new GridLayout(3,3,5,5));
l1=new JLabel("test");
l2=new JLabel("test2");
l3=new JLabel("test2");
p1.add(l1);
p1.add(l2);
p1.add(l3);
mp.add(p1);
add(mp);
}
public void actionPerformed(ActionEvent AE)
{
}
}
The applet is running blank
EDIT: Modified the code the code now runs but im little confused how the layout manager works the gridlayout with values 3,3,5,5 says there should be 3 rows and 3 columns with 5padding.SO why is the applet like this