MainClass.javapublic class MainClass{ public static void main(String args[]){ new ManagerWindow();}}Student.javapublic class Studentimplements java.io.Serializable{ String number,name;public void setNumber(String number){ this.number=number;}public String getNumber(){ return number;}public void setName(String name){ =name;}public String getName(){ return name;}}ManagerWindow.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.Hashtable;public class ManagerWindow extends Frame implements ActionListener{ InputStudent 基本信息录入=null;Inquest 基本信息查询=null;Button 查询;Hashtable 基本信息=null;File file=null;public ManagerWindow(){ 基本信息=new Hashtable();查询=new Button("查询");查询.addActionListener(this);file=new File("基本信息.txt");if(!file.exists()){ try{ FileOutputStream out=new FileOutputStream(file);ObjectOutputStream objectOut=new ObjectOutputStream(out);objectOut.writeObject(基本信息);objectOut.close();out.close();}catch(IOException e){}}基本信息录入=new InputStudent(file);基本信息查询=new Inquest(this,file);add(基本信息录入,BorderLayout.CENTER);add(查询,BorderLayout.SOUTH);addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0);}});setVisible(true);setBounds(100,50,420,380);validate();}public void actionPerformed(ActionEvent e){ 基本信息查询.setVisible(true);}}InputStudent.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.*;public class InputStudent extends Panel implements ActionListener { Hashtable 基本信息表=null;TextField 学号,姓名;Student 学生=null;Button 录入;FileInputStream inOne=null;ObjectInputStream inTwo=null;FileOutputStream outOne=null;ObjectOutputStream outTwo=null;File file=null;public InputStudent(File file){ this.file=file;学号=new TextField(10);姓名=new TextField(10);录入=new Button("录入");录入.addActionListener(this);add(new Label("学号:",Label.CENTER));add(学号);add(new Label("姓名:",Label.CENTER));add(姓名);add(录入);validate();}public void actionPerformed(ActionEvent e){ if(e.getSource()==录入){ String number="";number=学号.getText();if(number.length()>0){ try { inOne=new FileInputStream(file);inTwo=new ObjectInputStream(inOne);基本信息表=(Hashtable)inTwo.readObject();inOne.close();inTwo.close();}catch(Exception ee){}if(基本信息表.containsKey(number)){ String m="信息已存在,新的信息将覆盖原信息!";int ok=JOptionPane.showConfirmDialog(this,m,"确认",JOptionPane.YES_NO_OPTION,RMATION_MESSAGE);if(ok==JOptionPane.YES_OPTION){ record(number);}}else{ record(number);}}else{ String warning="必须要输入学号!";JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);}}}public void record(String number){ String name=姓名.getText();学生=new Student();学生.setNumber(number);学生.setName(name);try{ outOne=new FileOutputStream(file);outTwo=new ObjectOutputStream(outOne);基本信息表.put(number,学生);outTwo.writeObject(基本信息表);outTwo.close();outOne.close();学号.setText(null);姓名.setText(null);}catch(Exception ee){}}}Inquest.javaimport java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;import javax.swing.*;public class Inquest extends Dialog implements ActionListener{ Hashtable 基本信息表=null;TextField 学号;Button 按学号查询,查询全部;TextArea show=new TextArea(6,28);FileInputStream inOne=null;ObjectInputStream inTwo=null;File file=null;public Inquest(Frame f,File file){ super(f,"查询对话框",false);setLayout(new FlowLayout());this.file=file;学号=new TextField(10);按学号查询=new Button("按学号查询");按学号查询.addActionListener(this);查询全部=new Button("查询全部");查询全部.addActionListener(this);add(new Label("输入要查询的学号:",JLabel.CENTER));add(学号);add(按学号查询);add(查询全部);add(show);setBounds(100,200,360,270);addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ setVisible(false);}});}public void actionPerformed(ActionEvent e){ show.setText(null);readHashtable();if(e.getSource()==按学号查询){ String number="";number=学号.getText();if(number.length()>0){ if(基本信息表.containsKey(number)){ Student stu=(Student)基本信息表.get(number);show.setText("学号:"+stu.getNumber()+" 姓名:"+stu.getName()); }else{ String warning="该学号不存在!";JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);}}else{ String warning="必须要输入学号!";JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);}}if(e.getSource()==查询全部){ Enumeration enum=基本信息表.elements();while(enum.hasMoreElements()) //遍历当前散列表{ Student stu=(Student)enum.nextElement();show.append("学号:"+stu.getNumber()+" 姓名:"+stu.getName()+"\n"); }}}public void readHashtable(){ try { inOne=new FileInputStream(file);inTwo=new ObjectInputStream(inOne);基本信息表=(Hashtable)inTwo.readObject();inOne.close();inTwo.close();}catch(Exception ee) {}}}。