怎样给你发过去呢?用忽然数据库连接不? 追问: java吧 不要用 数据库 了 用文件就行了 回答: mport java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; class Tjsc implements ActionListener{ private JFrame frame=new JFrame("学生信息添加"); private JLabel sfzLab = new JLabel(" 身份证号 ") ; private JLabel bnameLab = new JLabel("姓 名") ; private JLabel xbLab = new JLabel("性 别") ; private JLabel dateLab = new JLabel(" 出生日期 ") ; private JLabel xhLab = new JLabel(" 学号 ") ; private JLabel xiLab = new JLabel("系别") ; private JButton tianjia = new JButton("添加"); private JButton exit = new JButton("退出"); private JButton reset = new JButton("重置"); private JButton delete = new JButton("删除"); private JLabel infoLab = new JLabel("学生 信息管理 ") ; private JTextField sfzText = new JTextField() ; private JTextField bnameText = new JTextField() ; private JTextField xbText = new JTextField() ; private JTextField dateText = new JTextField() ; private JTextField xhText = new JTextField() ; private JTextField xiText = new JTextField() ; private JTextField sfzText1 = new JTextField() ; private JTextField bnameText1 = new JTextField() ; private JTextField xbText1 = new JTextField() ; private JTextField dateText1 = new JTextField() ; private JTextField xhText1= new JTextField() ; private JTextField xiText1 = new JTextField() ; private ImageIcon co=new ImageIcon("image/0422293335L.jpg"); JLabel label=new JLabel(co); Tjsc(){ frame.setLayout(null); label.setBounds(0, 0, 500,330); frame.add(label); sfzLab.setForeground(Color.BLACK); bnameLab.setForeground(Color.BLACK); xbLab.setForeground(Color.BLACK); dateLab.setForeground(Color.BLACK); xhLab.setForeground(Color.BLACK); xiLab.setForeground(Color.BLACK); infoLab.setForeground(Color.BLACK); sfzLab.setBounds(80,35,80,20) ; bnameLab.setBounds(80,65,80,20) ; xbLab.setBounds(265,95,60,20) ; dateLab.setBounds(80,95,60,20); xhLab.setBounds(265,35,60,20); xiLab.setBounds(265,65,60,20); sfzText.setBounds(135,35,100,20) ; bnameText.setBounds(135,65,100,20) ; xbText.setBounds(300,95,100,20) ; dateText.setBounds(135,95,100,20) ; xhText.setBounds(300,35,100,20) ; xiText.setBounds(300,65,100,20) ; sfzText1.setBounds(135,180,100,20) ; bnameText1.setBounds(135,210,100,20) ; xbText1.setBounds(300,240,100,20) ; dateText1.setBounds(135,240,100,20) ; xhText1.setBounds(300,180,100,20) ; xiText1.setBounds(300,210,100,20) ; tianjia.setBounds(150,140,60,20); exit.setBounds(290,140,60,20); reset.setBounds(220,140,60,20); delete.setBounds(230,270,60,20); infoLab.setBounds(200,280,120,70); label.add(sfzLab) ; label.add(bnameLab) ; label.add(xbLab) ; label.add(dateLab) ; label.add(xhLab) ; label.add(xiLab) ; label.add(infoLab); label.add(sfzText) ; label.add(bnameText) ; label.add(xbText) ; label.add(dateText) ; label.add(xhText) ; label.add(xiText) ; label.add(tianjia); label.add(exit); label.add(delete); label.add(reset); label.add(sfzText1) ; label.add(bnameText1) ; label.add(xbText1) ; label.add(dateText1) ; label.add(xhText1) ; label.add(xiText1) ; frame.setSize(500,360) ; frame.getContentPane().setBackground(Color.WHITE) ; frame.setLocation(300,200) ; frame.setVisible(true) ; tianjia.addActionListener(this); exit.addActionListener(this); reset.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(e.getSource()==reset){ sfzText.setText("") ; bnameText.setText("") ; xbText.setText("") ; dateText.setText("") ; xhText.setText("") ; xiText.setText("") ; infoLab.setText("学生信息管理"); } } }); } public void actionPerformed(ActionEvent e){ if(e.getSource()==tianjia){ if(sfzText.getText().trim().equals("")||bnameText.getText().trim().equals("")||xbText.getText().trim().equals("")||dateText.getText().trim().equals("")||xhText.getText().trim().equals("")||xiText.getText().trim().equals("")) infoLab.setText("信息不能为空"); else { sfzText1.setText(sfzText.getText().trim()) ; bnameText1.setText(bnameText.getText().trim()); xbText1.setText(xbText.getText().trim()) ; dateText1.setText(dateText.getText().trim()) ; xhText1.setText(xhText.getText().trim()) ; xiText1.setText(xiText.getText().trim()) ; infoLab.setText("添加成功"); } delete.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(e.getSource()==delete){ sfzText1.setText("") ; bnameText1.setText("") ; xbText1.setText("") ; dateText1.setText("") ; xhText1.setText("") ; xiText1.setText("") ; infoLab.setText("学生信息管理"); } } }); } if(e.getSource()==exit){ //System.exit(1); frame.setVisible(false) ; } } } import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; class Cx implements ActionListener{ private JFrame frame=new JFrame("学生信息查询"); private JButton search = new JButton("查询"); private JButton reset = new JButton("重置"); private JButton exit = new JButton("退出"); private JLabel numLab = new JLabel("学号") ; private JLabel nameLab = new JLabel("姓名") ; private JLabel keLab=new JLabel("班级"); private JLabel fenLab=new JLabel("班主任"); private JLabel infoLab = new JLabel("学生信息管理") ; private JTextField numText = new JTextField() ; private JTextField nameText = new JTextField() ; private JTextField keText = new JTextField() ; private JTextField fenText = new JTextField() ; private JTextField numText1 = new JTextField() ; private JTextField nameText1 = new JTextField() ; private JTextField keText1 = new JTextField() ; private JTextField fenText1 = new JTextField() ; ; private ImageIcon co=new ImageIcon("image/9.jpg"); JLabel label=new JLabel(co); JTable table=null; DefaultTableModel tableModel=new DefaultTableModel(); String[] titles={"学号","姓名","班级","班主任"}; String a,b,c,d,f; Cx(){ frame.setLayout(null) ; frame.add(label); label.setBounds(0, 0, 500, 400); numLab.setBounds(50,30,60,20) ; nameLab.setBounds(290,30,60,20) ; keLab.setBounds(50,65,60,20) ; fenLab.setBounds(290, 65, 60, 20); infoLab.setBounds(210,200,220,30); numText.setBounds(115,30,100,20) ; nameText.setBounds(355,30,100,20) ; keText.setBounds(115,65,100,20) ; fenText.setBounds(355,65,100,20) ; search.setBounds(50,170,60,20) ; reset.setBounds(200,170,60,20) ; exit.setBounds(350,170,60,20) ; numText1.setBounds(0,280,125,20) ; nameText1.setBounds(125,280,125,20) ; keText1.setBounds(250,280,125,20) ; fenText1.setBounds(375,280,125,20) ; label.add(numLab); label.add(nameLab) ; label.add(keLab) ; label.add(fenLab) ; label.add(infoLab) ; label.add(numText); label.add(nameText) ; label.add(keText) ; label.add(fenText); label.add(numText1); label.add(nameText1) ; label.add(keText1) ; label.add(fenText1); label.add(search) ; label.add(reset) ; label.add(exit); frame.setSize(500,400) ; tableModel.setColumnIdentifiers(titles); table=new JTable(tableModel); JScrollPane scr=new JScrollPane(table); label.add(scr); scr.setBounds(0, 260, 500,300); frame.setLocation(300,200) ; frame.setVisible(true) ; search.addActionListener(this) ; exit.addActionListener(this) ; reset.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(e.getSource()==reset){ numText.setText("") ; nameText.setText("") ; keText.setText("") ; fenText.setText(""); infoLab.setText("已重置") ; } } }) ; } public void actionPerformed(ActionEvent e){ if(e.getSource()==exit){ /*System.exit(0);*/ frame.setVisible(false) ; } String tnum = numText.getText(); if(numText.getText().trim().equals("")) infoLab.setText("学号不能为空!"); if("082021031".equals(tnum)){ nameText1.setText(" 王鹏 "); numText1.setText("082021031"); keText1.setText("计网081"); fenText1.setText("胡娜"); infoLab.setText("查询成功!"); } else { infoLab.setText("查询失败!"); } } } public class chaxun{ public static void main(String[] args){ new Cx(); } } 这是我做的 教务管理系统 ~~~ 学生信息管理系统 文件丢失·~你改改字~~就差不多一样·~