[/color][size=medium][/size]
[color=red]
package ruan_jian_gong_cheng;
//系统内涉及一个TXT 运行前注意创建一下 并保存相应路径
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileInputStream;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeMap;
import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class library_save_a_place extends JFrame {
//private static t=0; (未实现)//该全局变量座位一个标志,用于实现成功占座后销毁相关的JDialog
private static JButton button1 = new JButton("登 录");
private JButton button2 = new JButton("忘记密码 ");
final static TreeMap<String, String> LXR = new TreeMap<String, String>();

public library_save_a_place(){ // 初始化登录界面
setSize(350, 200);
setLocation(450, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("占座系统用户登录界面");

setLayout(null);
JLabel lable = new JLabel("书籍是人类进步的阶梯");
JLabel lable1 = new JLabel("卡 号:");
JLabel lable2 = new JLabel("密 码:");
final JTextField t1 = new JTextField(20);
final JPasswordField t2 = new JPasswordField(20);
lable.setBounds(100, 10, 200, 20);
lable1.setBounds(20, 40, 80, 20);
lable2.setBounds(20, 60, 80, 20);
t1.setBounds(90, 40, 200, 20);
t2.setBounds(90, 60, 200, 20);
button1.setBounds(80, 90, 90, 20);
button2.setBounds(180, 90, 90, 20);
add(lable);
add(lable1);
add(t1);
add(lable2);
add(t2);
add(button1);
add(button2);

try {
DUSJ();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button1) {
String s1 = t1.getText();
@SuppressWarnings("deprecation")
String s2 = t2.getText();
int t=1; //t用于接受密码验证函数返回的值
if (s1.isEmpty())
JOptionPane.showMessageDialog(button1,
"登录失败,请输入卡号和密码!");
else if (!(s1.isEmpty()) && s2.isEmpty())
JOptionPane.showMessageDialog(button1,
"登录失败,请输入密码!");
else {
t=password_authentication(s1,s2);
if(t==1){
JOptionPane.showMessageDialog(button1, "登录成功!");
frame1 f1 = new frame1();
f1.setVisible(true);
library_save_a_place.this.dispose();
}
}
}
}
});

button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button2) {
JOptionPane.showMessageDialog(button2,
"忘记密码,请到学校现代教育中心进行改密!");
}
}
});

addWindowListener(new WindowAdapter() // 关闭事件
{
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}

class frame1 extends JFrame { // 用户主界面
/**
*
*/
private static final long serialVersionUID = 1L;
private JButton button11 = new JButton("查询占座");
private JButton button12 = new JButton("修改占座");
private JButton button13 = new JButton("历史查询");
private JButton button14 = new JButton("退出系统");

public frame1(){
setSize(400, 250);
setLocation(450, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("占座系统用户主界面 (frame1)");

setLayout(null);
JLabel lable = new JLabel("江西财经大学图书馆占座系统");
JLabel lable1 = new JLabel("用户:");
JLabel lable2 = new JLabel("最新占座信息:");
JLabel lable3 = new JLabel("XXX");
JLabel lable4 = new JLabel("占座");
lable.setBounds(100, 10, 200, 20);
lable1.setBounds(20, 40, 80, 20);
lable2.setBounds(20, 60, 100, 20);
lable3.setBounds(90, 40, 200, 20);
lable4.setBounds(180, 60, 200, 20);
button11.setBounds(60, 100, 90, 30);
button12.setBounds(160, 100, 90, 30);
button13.setBounds(260, 100, 90, 30);
button14.setBounds(260, 160, 90, 30);
add(lable);
add(lable1);
add(lable3);
add(lable2);
add(lable4);
add(button11);
add(button12);
add(button13);
add(button14);