I am new to Java and am trying to run this code. What could be error in the following code—my JTextField, txtfld, is shown just as a line instead of as a full text box?
public class calculator
{
    public static void main(String s[])
    {
        JFrame j=new JFrame();
        j.setSize(400,600);
        JPanel p1=new JPanel();
        JPanel p2=new JPanel();
        p1.setSize(400, 100);
        p2.setSize(400, 500);
        p1.setLocation(0, 0);
        p2.setLocation(0, 100);
        p2.setLayout(new GridLayout(4,4));
        j.add(p1);
        j.add(p2);
        JTextField txtfld=new JTextField();
        txtfld.setSize(390, 92);
        txtfld.setLocation(5, 2);
        //txtfld.setVisible(true);    
        p1.add(txtfld);
        j.setVisible(true);
    }
}
 
     
    