文档介绍:package javabigwork;
import .*;
import .*;
import .*;
import .*;
public class LoginFrm extends JFrame implements ActionListener{
private JLabel lblTitle=new JLabel("欢迎进入家庭财务管理系统");
private JLabel lblName=new JLabel("用户名");
private JLabel lblPwd=new JLabel("密码");
private JTextField txtName=new JTextField();
private JPasswordField txtPwd=new JPasswordField();
private JButton btnOk=new JButton("用户登陆");
private JButton btnCancel=new JButton("退出系统");
private String driver = "";
private String url = "jdbc:odbc:mydb";
private int rowcount=0;
public LoginFrm(){
JPanel jp = (JPanel) ();
(null);
(lblTitle);
(300, 50, 200, 50);
(lblName);(200, 100, 100, 20);
(txtName);(500, 100, 100, 20);
(lblPwd);(200, 150, 100, 20);
(txtPwd);(500, 150, 100, 20);
(btnOk);(200, 220, 100, 20);
(btnCancel);(500, 220, 100, 20);
("家庭用户登陆");
(800,400);
(true);
(EXIT_ON_CLOSE);
(this);
(this);
}
public void actionPerformed(ActionEvent e) {
if(() == btnOk){
String [][] rows = ();
String s1=();
String s2=();
for(int i=0;i<rowcount;i++){
if((rows[i][0])){
if((rows[i][1])){
(this, "用户名和密码正确
");
new CustomerFrm();
}
else
(this, "用户名或密码错误");
}
}
}
if(() == btnCancel){
(0);
}
}
public String[][] queryCustomers() {
String[][] rows = null;
try {
(driver);
Connection con = (url);
Statement cmd = ();
String sql