package cn.user;
import java.awt.*; import javax.swing.*; 
import javax.swing.border.TitledBorder;import java.awt.event.*; 
import java.sql.*; //@SuppressWarnings("unused")
class UserLogin extends JFrame implements ActionListener{
private JLabel username;
private JLabel password;
private JTextField usertext;
private JPasswordField passwordfield;
private JButton land;
private JButton exit;

private PreparedStatement pre; 
private ResultSet res; 
public static void main(String[] args){
UserLogin login=new UserLogin();
login.setVisible(true);
//System.out.println("yes");
}

public UserLogin(){
super();
setTitle("登录界面");
setBounds(100,100,260,210);
getContentPane().setLayout(null);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel username=new JLabel("用户名:");
JTextField usertext=new JTextField();
username.setBounds(38, 83, 60, 15);
this.add(username);
usertext.setBounds(89,80,120,21);
this.add(usertext);

JLabel password=new JLabel("密码:");
JPasswordField passwordfield=new JPasswordField();
password.setBounds(39, 107, 60, 15);
this.add(password);
passwordfield.setBounds(89, 104, 120, 21);
passwordfield.setEchoChar('*');
this.add(passwordfield);

JLabel lb=new JLabel();
lb.setBorder(new TitledBorder(null,"",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,null));
lb.setForeground(new Color(255,0,0));
lb.setFont(new Font("",Font.BOLD,18));
lb.setText("     图书管理系统");
lb.setBounds(50,28,170,36);
getContentPane().add(lb);

JButton land=new JButton("登录");
land.setBounds(67,131,60,23);
this.add(land);

JButton exit=new JButton("退出");
exit.setBounds(141,131,60,23);
this.add(exit);

land.addActionListener(this);
exit.addActionListener(this);
this.validate(); 

}

@Override
public void actionPerformed(ActionEvent l) {
// TODO 自动生成的方法存根
System.out.println("yes");
if(l.getSource()==land){ 
System.out.println("yes");
}
else if(l.getSource()==exit){
System.out.println("no");
}

}

}