posted 18 years ago
Hi everyone
I'm trying to build a JFrame that includes JPanels, JLabels, JButton, and JTextArea; I don't know why i get an error when i try to compile the code
code:
private JPanele panel1 = null;
private JPanele panel2 = null;
private JPanele panel2a = null;
private JPanele panel2b = null;
private JPanele panel2c = null;
private JPanele panel2a1 = null;
private JLabel label1 = null;
private JLabel label2 = null;
private JLabel label3 = null;
private Jlabel label4 = null;
private JLabel label5 = null;
private JTextField textfield1 = null;
private JTextField textfield2 = null;
private JTextField textfield3 = null;
private JTextField textfield4 = null;
private JTextField textfield5 = null;
private JTextArea textarea1 = null;
private JButton button1 = null;
private JButton button2 = null;
private JButton button3 = null;
private JButton button4 = null;
panel1 = new JPanel();
panel2 = new JPanel();
panel2a = new JPanel();
panel2b = new JPanel();
panel2c = new JPanel();
panel2a1 = new JPanel();
label1 = new JLabel("First Name");
label2 = new JLabel("Last Name");
label3 = new JLabel("Middle Name");
label4 = new JLabel("Age");
label5 = new JLabel("Gender");
textfield1 = new JTextField(20);
textfield2 = new JTextField(20);
textfield3 = new JTextField(20);
textfield4 = new JTextField(20);
textfield5 = new JTextField(20);
textarea1 = new JTextArea(50, 20);
JScrollPane scrollpane = new JScrollPane(textarea1);
button1 = new JButton("Save");
button1.addActionListener(al);
button2 = new JButton("Next");
button2.addActionListener(al);
button3 = new JButton("Load");
button3.addActionListener(al);
button4 = new JButton("Clear");
button4.addActionListener(al);
panel2.setLayout(new GridLayout(3. 1, 0, 0));
panel2a.setLayout(new GridLayout(2. 1, 0, 0));
panel1.add(scrollpane);
panel2a1.add(label1);
panel2a1.add(textfield1);
panel2a1.add(label2);
panel2a1.add(textfield2);
panel2a1.add(label3);
panel2a1.add(textfield3);
panel2a1.add(label4);
panel2a1.add(textfield4);
panel2a1.add(label5);
panel2a1.add(textfield5);
panel2.add(panel2a);
panel2.add(panel2b);
panel2.add(panle2c);
this getContentPane().setLayout(new GridLayout(2, 1, 0, 0);
this.getContentPane().add(panel1);
this.getContentPane().add(panel2);
this.setSize(800,600);
this.setLocation(200,200);
this.pack();
this.setVisible(true);
}//end constructor
Error:
illegal start of expresion
private JPanel panel1 = null;
any help is greatly appriciated