i am trying to add some labels and textfields on a panel and i have done it...but problem is, the size of the textfield is extra large thn default.do not know how to overcome it.please help.here is some code....


@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == a){

panel.removeAll();
panel.updateUI();

panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));



JLabel name = new JLabel("Enter Your Name :");
name.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(name);
JTextField nameBox = new JTextField(30);
nameBox.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(nameBox);


JLabel fname = new JLabel("Enter Your Father's Name :");
fname.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(fname);
JTextField fnameBox = new JTextField(30);
fnameBox.setAlignmentX(Component.CENTER_ALIGNMENT) ;
panel.add(fnameBox);

JLabel mname = new JLabel("Enter Your Mother's Name :");
mname.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(mname);
JTextField mnameBox = new JTextField(30);
mnameBox.setAlignmentX(Component.CENTER_ALIGNMENT) ;
panel.add(mnameBox);