e mới hoc ve java ,E đang làm bài mà cứ gap lỗi này woài mà hok bik ??[IMG]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAA l21bKAAAAA1BMVEXh5PJm+yKVAAAAAXRSTlMAQObYZgAAAApJR EFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=[/IMG] anh e giúp e copy vào chay thử xem giúp e 1 cai nha . e thanks nhiu lắm [IMG]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAA l21bKAAAAA1BMVEXh5PJm+yKVAAAAAXRSTlMAQObYZgAAAApJR EFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=[/IMG]

Bài của e là . từ cái Panel ban đầu. >chọn CONTINUE > nó nhảy sang Panel 2.
/////////
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.applet.*;
import java.awt.event.*;
public class Project extends java.applet.Applet implements ActionListener {

JPanel panel1 , panel2;
JLabel lblTitle1, lblTitle2, lblLogin, lblUserName,lblPassWord,lblRePassWord,
lblPersonal, lblFirstName, lblLastName, lblEmail, lblGender, lblPhone, lblPreferred,
lblProfessional, lblExperience, lblSkill, lblJob ,lbl,
//p2
lblTille3, lblGraduation, lblGrade, lblSchool, lblUniversity, lblGraduate,
lblTestDate, lblScore, lblTOEFL, lblDetails, lbl1;
JPasswordField txtPassWord, txtRePassWord ;

JTextField txtUserName, txtFirstName, txtLastName, txtEmail, txtPhone, txtExperience, txtSkill,
//p2
txtGrade, txtSchool, txtUniversity, txtTestDate, txtScore, txtTOEFL, txtDetails;


JComboBox cbGender, cbPreferred, cbJob,
//p2
cbGraduation;
JButton btnContinue, btnReset,
//p2
btnSubmit;
Font f5 = new Font("Monotype Corsiva", Font.BOLD,20);
Font f6 = new Font("Times New Roman ", Font.BOLD,13);
//////////////////////////////

Font f= new Font("Heveltica",Font.BOLD+Font.ITALIC,14);
Font f1= new Font("Heveltica",Font.ITALIC,12);

CardLayout cardLayout;
Container con;



public void init() {

Container con = getContentPane();
cardLayout = new CardLayout();
con.setLayout(cardLayout);
// con.add("PlaceMe",panel1);
// con.add("Qualifi",panel2);

CreatePanel1();
CreatePanel2();


}

public void CreatePanel1()
{
panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());

lbl= new JLabel(" ");
lblTitle1 = new JLabel("PLACE ME,INC");
lblTitle1.setFont(f5);
lblTitle2 = new JLabel("Job Seekers Registration From");
lblTitle2.setFont(f6);
lblLogin = new JLabel("LOGIN DETAIL");
lblUserName =new JLabel("UserName:");
lblPassWord =new JLabel("PassWord:");
lblRePassWord =new JLabel("Re-enter PassWord:");
lblPersonal = new JLabel("PERSONAL DETAIL:");
lblFirstName =new JLabel("FirstName:");
lblLastName = new JLabel("LastName:");
lblEmail = new JLabel("Email Adress:");
lblGender = new JLabel("Gender:");
lblPhone =new JLabel("Phone Number:");
lblPreferred =new JLabel("Preferred Job Location:");
lblProfessional =new JLabel ("PROFESSIONAL DETAIL");
lblExperience =new JLabel("Experience (in year):");
lblSkill =new JLabel("Key Skill:");
lblJob =new JLabel("Job Computer");

txtUserName = new JTextField (15);
txtPassWord = new JPasswordField (15);
txtRePassWord = new JPasswordField (15);
txtFirstName = new JTextField (15);
txtLastName = new JTextField (15);
txtEmail = new JTextField (15);
txtPhone = new JTextField (15);
txtExperience = new JTextField (15);
txtSkill= new JTextField(15);

String [] gender={"Male","Female"};
cbGender = new JComboBox(gender);

String[] preferred={"Washington","New York","Columbia"};
cbPreferred =new JComboBox(preferred);

String[] job ={"Computer","Doctor","Manager"};
cbJob = new JComboBox(job);

btnContinue =new JButton("Continue");
btnContinue.addActionListener(this);

btnReset =new JButton("Reset");
// btnReset.addActionListener(this);
// cardLayout.show(con,"PlaceMe");


addComponent(panel1,lblTitle1,1,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblTitle2,2,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lbl,3,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblLogin, 4,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblUserName, 5,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblPassWord, 5,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtPassWord, 5,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblRePassWord, 6,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtPassWord, 6,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lbl, 7,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblPersonal, 8,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblFirstName, 9,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtFirstName, 9,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblLastName, 9,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtLastName, 9,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblEmail, 10,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtEmail, 10,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblGender, 10,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,cbGender, 10,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblPhone, 11,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtPhone,11,2,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);
addComponent(panel1,lblPreferred, 11,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,cbPreferred, 11,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lbl, 12,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblProfessional, 13,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblExperience, 14,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtExperience, 14,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblSkill, 14,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,txtSkill, 14,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,lblJob, 15,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,cbJob, 15,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,btnContinue, 16,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel1,btnReset,16,4,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);
con.add("PlaceMe",panel1);
}

public void CreatePanel2()
{
panel2 = new JPanel();
panel2.setLayout(new GridBagLayout());

lbl1 = new JLabel(" ");
lblTille3 = new JLabel ("QUALIFICATION");
lblGraduation = new JLabel("Graduation Degree Programing:");
lblGrade= new JLabel("Grade:");
lblSchool = new JLabel("School:");
lblUniversity = new JLabel("University:");
lblGraduate = new JLabel("Graduate Recore examision (GRE)Score:");
lblTestDate = new JLabel("Test Date:");
lblScore = new JLabel ("Score %:");
lblTOEFL = new JLabel("TOEFL Score (if required):");
lblDetails = new JLabel("Detail of recent Honors and Awars:");

txtGrade = new JTextField(15);
txtSchool = new JTextField(15);
txtUniversity = new JTextField(15);
txtTestDate = new JTextField(15);
txtScore = new JTextField(15);
txtTOEFL = new JTextField(15);
txtDetails = new JTextField(15);

String[] program={"Master", "Programing", "Manager"};
cbGraduation = new JComboBox(program);

btnSubmit = new JButton();
// btnSubmit.addActionListener(this);

//cardLayout.show(con,"Qualifi");
addComponent(panel2,lblTille3, 1,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lblGraduation, 2,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,cbGraduation, 2,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lblGrade, 2,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtGrade,2,4,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);

addComponent(panel2,lblSchool, 3,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtSchool, 3,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lblUniversity, 3,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtUniversity, 3,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lbl1, 4,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lblGraduate,5,1,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);
addComponent(panel2,lblTestDate, 6,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtTestDate, 6,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,lblScore, 6,3,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtScore,6,4,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);
addComponent(panel2,lblTOEFL, 7,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtTOEFL,7,2,1,1, GridBagConstraints.CENTER,GridBagConstraints.CENTE R);
addComponent(panel2,lblDetails, 8,1,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,txtDetails, 8,2,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
addComponent(panel2,btnSubmit, 9,4,1,1, GridBagConstraints.CENTER, GridBagConstraints.CENTER);
con.add("Qualifi",panel2);
}

public static void addComponent(Container container,Component component,int col,
int row,int ncol,int nrow,int fill, int anchor)
{
LayoutManager lm = container.getLayout();
if (!(lm instanceof GridBagLayout))
{
try
{
throw new AWTException("Invalid layout " + lm);
}
catch(AWTException e)
{
System.out.println("Error: " + e);
}
}
else
{
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = col;
gbc.gridy = row;
gbc.gridwidth = ncol;
gbc.gridheight = nrow;
gbc.fill = fill;
gbc.anchor = anchor;
((GridBagLayout)lm).setConstraints(component, gbc);
container.add(component);
}
}

public void actionPerformed(ActionEvent evt )
{
// Goi phuong thuc getSource() de nhan lay thanh phan phat ra su kien
Object obj = evt.getSource();
if (obj == btnContinue)
{
cardLayout.show(con,"Qualifi");

}

}


}
/*
<APPLET CODE = "Project.class" WIDTH=400 HEIGHT = 400>
</APPLET>
*/