java课程设计学生信息管理系统。

import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
//主函数
public class test01 {
public static void main(String[] args) {
MyFrame01 my=new MyFrame01();
}
}
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

/**
* 登陆界面
* @author dd
*
*/
java课程设计学生信息管理系统。_第1张图片
public class MyFrame01 extends JFrame {

private JButton btn1;
private JButton btn2;

private JTextField tf;
private JPasswordField pf;

public void init() {

    /*setLayout(new FlowLayout());*/
    setTitle("学生登记系统");
    setSize(300, 180);
    setLocationRelativeTo(null);

    tf=new JTextField(5);
    pf=new JPasswordField(5);
}
public void add1(){

    btn1=new JButton("登陆"); 
    JLabel name=new JLabel("       账号");
    JLabel password=new JLabel("       密码");
    JLabel bq1=new JLabel("  ");
    JLabel bq2=new JLabel("  ");


    JPanel p=new JPanel();
    JPanel p1=new JPanel();
    JPanel p2=new JPanel();
    JPanel p3=new JPanel();
    JPanel p4=new JPanel();
    JPanel p5=new JPanel();



    btn1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
        try {
            pd();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        }
    });


    btn2=new JButton("注册");
    btn2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new MyFrame03();
            MyFrame01.this.dispose();
        }
    });
    this.setContentPane(p); //设置为内容面板  总布
    p.setLayout(new BorderLayout());
    p1.setLayout(new FlowLayout());
    p2.setLayout(new GridLayout(2,2));
    p3.setLayout(new FlowLayout());



     p1.add(new JLabel("登陆系统"));
     p2.add(name);
     p2.add(tf);
     p2.add(password);
     p2.add(pf);
     p3.add(btn1);
     p3.add(btn2);
     p4.add(bq1);
     p5.add(bq2);


     p.add(p1,BorderLayout.NORTH);
     p.add(p2,BorderLayout.CENTER);
     p.add(p3,BorderLayout.SOUTH);
     p.add(p4,BorderLayout.EAST);

}


public MyFrame01(){
    JPanel cp=(JPanel) getContentPane();
    cp.setLayout(new FlowLayout());

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    init();
    add1();
    setVisible(true);
}
public void pd() throws IOException{
    File f=new File("f:\\信息系统账号");
    String fname []=f.list();
    String a=null;
    for(String s:fname){
        if (s.equals(tf.getText()+".txt")) {    
        a=s;
        Reader r=new FileReader("f:\\信息系统账号\\"+s);
        String b=null;
        char cs[]=new char[10];
        int len=0;
        while ((len=r.read(cs))!=-1) {
            b=new String(cs,0,len);
        }
        if (pf.getText().equals(b)) {
            JOptionPane.showConfirmDialog(MyFrame01.this, "输入正确!", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
            new MyFrame04();
            MyFrame01.this.dispose();
        }   else {
            JOptionPane.showConfirmDialog(MyFrame01.this, "输入有误,请重新输入!", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
            MyFrame01.this.dispose();
            new MyFrame01();
        }   
}
}

}}

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
* 信息录入
* @author dd
*
*/
java课程设计学生信息管理系统。_第2张图片
public class MyFrame02 extends JFrame {
private String xb;
private String bj;
private String dh;
private String sj;
private String dzyx;
private String txdz;
private String yzbm;

private JMenuBar bar;
private JMenu my_file;
private JMenu my_edit;
private JMenu my_Source;
private JMenu my_Refactor;
private JMenu my_Navigate;
private JMenu my_Search;
private JMenu my_Project;
private JMenu my_Run;
private JMenu my_Help;

private static JTextField tf1;
private static JTextField tf2;
private static JTextField tf3;
private static JTextField tf4;
private static JTextField tf5;
private static JTextField tf6;
private static JTextField tf7;
private static JTextField tf8;
private static JButton btn1;
private static JButton btn2;
public void init() {

    setLayout(new FlowLayout());
    setTitle("学生信息录入");
    setSize(500, 300);
    setLocationRelativeTo(null);


}
public void add(){
    bar=new JMenuBar();
     my_file=new JMenu("开始");
     my_edit=new JMenu("插入  ");
     my_Source=new JMenu("页面布局");
     my_Refactor=new JMenu("引用");
     my_Navigate=new JMenu("审阅");
     my_Search=new JMenu("章节");
     my_Project=new JMenu("开发工具");
     my_Run=new JMenu("云服务");
     my_Help=new JMenu("帮助");

     bar.add(my_file);
     bar.add(my_edit);
     bar.add(my_Source);
     bar.add(my_Refactor);
     bar.add(my_Navigate);
     bar.add(my_Search);
     bar.add(my_Project);
     bar.add(my_Run);
     bar.add(my_Help); 



     setJMenuBar(bar);
}

public MyFrame02() {

  JPanel p=new JPanel();
  JPanel p1=new JPanel();
  JPanel p2=new JPanel();
  JPanel p3=new JPanel();
     p.setLayout(new BorderLayout());

     p1.setLayout(new GridLayout(4,2));
     p2.setLayout(new FlowLayout());

     p1.add(new JLabel("姓名"));
     tf1=new JTextField(10);
     p1.add(tf1);
     p1.add(new JLabel("性别"));
     tf2=new JTextField(10);
     p1.add(tf2);
     p1.add(new JLabel("班级"));
     tf3=new JTextField(10);
     p1.add(tf3);
     p1.add(new JLabel("电话"));
     tf4=new JTextField(10);
     p1.add(tf4);
     p1.add(new JLabel("手机")); 
     tf5=new JTextField(10);
     p1.add(tf5);
     p1.add(new JLabel("电子邮箱"));
     tf6=new JTextField(10);
     p1.add(tf6);
     p1.add(new JLabel("通信地址"));
     tf7=new JTextField(10);
     p1.add(tf7);
     p1.add(new JLabel("邮政编码"));
     tf8=new JTextField(10);
     p1.add(tf8);
    btn1=new JButton("保存");
    btn2=new JButton("取消");
     p1.add(tf8);
     p2.add(btn1);
     p2.add(btn2);


     this.setContentPane(p);
     p.add(p1,BorderLayout.CENTER);
     p.add(p2,BorderLayout.SOUTH);

  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  init();
  add();
  setVisible(true);

  btn1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int x=JOptionPane.showConfirmDialog(MyFrame02.this, "是否保存?", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
            if (x==JOptionPane.OK_OPTION) {
                try {
                      cj();
                    test01();
                    JOptionPane.showConfirmDialog(MyFrame02.this, "保存成功", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
                MyFrame02.this.dispose();
                new MyFrame02();
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();

                }
        }else{
                JOptionPane.showConfirmDialog(MyFrame02.this, "保存失败", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
        }



        }
    });
  btn2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new MyFrame04();
            MyFrame02.this.dispose();

        }
    });
}

public static void test01() throws IOException{

    String name ="f:\\学生信息\\"+tf1.getText()+".txt";

    OutputStream os=new FileOutputStream(name);
  os.write("姓名:".getBytes());
  os.write(tf1.getText().getBytes());
  os.write("。".getBytes());
  os.write("性别:".getBytes());
  os.write(tf2.getText().getBytes());
  os.write("。".getBytes());
  os.write("班级:".getBytes());
  os.write(tf3.getText().getBytes());
  os.write("。".getBytes());
  os.write("电话:".getBytes());
  os.write(tf4.getText().getBytes());
  os.write("。".getBytes());
  os.write("手机:".getBytes());
  os.write(tf5.getText().getBytes());
  os.write("。".getBytes());
  os.write("电子邮箱:".getBytes());
  os.write(tf6.getText().getBytes());
  os.write("。".getBytes());
  os.write("通信地址:".getBytes());
  os.write(tf7.getText().getBytes());
  os.write("。".getBytes());
  os.write("邮政编码:".getBytes());
  os.write(tf8.getText().getBytes());
  os.close();
}

public static void cj(){
File f1=new File(“f:\学生信息”);
f1.mkdir();
}

}

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
/**
* 注册账号
* @author dd
*
*/
java课程设计学生信息管理系统。_第3张图片
public class MyFrame03 extends JFrame {
private JTextField tf;
private JPasswordField pf1;
private JPasswordField pf2;
private JLabel lb1;
private JLabel lb2;
private JLabel lb3;
private JLabel lb4;
private JButton btn1;
private JButton btn2;
private JPanel p=new JPanel();
private JPanel p1=new JPanel();
private JPanel p2=new JPanel();
private JPanel p3=new JPanel();
private JPanel p4=new JPanel();
private JPanel p5=new JPanel();
public void init(){

        setTitle("学生登记系统注册账号");
        setSize(300, 200);
        setLocationRelativeTo(null);
        lb1=new JLabel("  账号");
        lb2=new JLabel("  密码");
        lb3=new JLabel("  再次输入密码");
        lb4=new JLabel("注册账号");
        btn1=new JButton("确定");
        btn2=new JButton("取消");
        tf=new JTextField(20);
        pf1=new JPasswordField(20); 
        pf2=new JPasswordField(20); 

       this.setContentPane(p);
       p.setLayout(new BorderLayout());
       p1.setLayout(new FlowLayout());
       p2.setLayout(new GridLayout(3, 2));

       p1.add(lb4);
       p2.add(lb1);
       p2.add(tf);
       p2.add(lb2);
       p2.add(pf1);
       p2.add(lb3);
       p2.add(pf2);
       p3.add(btn1);
       p3.add(btn2);
       p.add(p1,BorderLayout.NORTH);
       p.add(p2,BorderLayout.CENTER);
       p.add(p3,BorderLayout.SOUTH);
       p.add(p4,BorderLayout.EAST);
       p.add(p5,BorderLayout.WEST);
   }

   public void add(){


        btn1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
            if (pf2.getText().toString().trim().equals(pf1.getText().toString().trim())) {

                try {
                    save();
                    int x=JOptionPane.showConfirmDialog(MyFrame03.this, "注册成功", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
                    if(x==JOptionPane.OK_OPTION){
                        fh();

                    }
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }else {
                JOptionPane.showConfirmDialog(MyFrame03.this, "输入密码不一致,请重新输入", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
                MyFrame03.this.dispose();
                new MyFrame03();
            }

            }
        });



        btn2.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                fh();

            }
        });

         /*add(tf);
         add(pf1);
         add(pf2);
         add(btn1);
         add(btn2);*/


   }
/*   public  JPanel getFilePanel(){
        JPanel p=new JPanel();
         p.setLayout(new FlowLayout());
         p.add(new JLabel("注册账号!"));
         return p;
    }*/

   public MyFrame03() {
       JPanel cp=(JPanel) getContentPane();
       cp.setLayout(new FlowLayout());

       /*cp.add(getFilePanel());*/
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        init();
        add();
        setVisible(true);
}

public void save() throws IOException{
File f1=new File(“f:\信息系统账号”);
f1.mkdir();
String name =”f:\信息系统账号\”+tf.getText()+”.txt”;

    OutputStream os=new FileOutputStream(name);
    //os.write(tf.getText().getBytes());
    os.write(pf1.getText().getBytes());
    os.close();

}
public void fh(){
MyFrame03.this.dispose();
new MyFrame01();
}

}
import java.awt.FlowLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

/**
* 选择需要进行的操作。
* 1.录入学生信息
* 2.修改学生信息
* 3.删除学生信息
* 4.注销
* @author dd
*
*/
java课程设计学生信息管理系统。_第4张图片
public class MyFrame04 extends JFrame{
private JButton btn1;
private JButton btn2;
private JButton btn3;
private JButton btn4;
public void init(){

    setLayout(new FlowLayout());
    setTitle("选择");
    setSize(275, 405);
    setLocationRelativeTo(null);

}

public void add(){
btn1=new JButton(“录入学生信息”);
btn1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new MyFrame02();
            MyFrame04.this.dispose();

        }
    });


    btn2=new JButton("查找学生信息");
    btn2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new MyFrame06();
            MyFrame04.this.dispose();
        }
    });

    btn3=new JButton("删除学生信息");
   btn3.addActionListener(new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent e) {
     new MyFrame05();
     MyFrame04.this.dispose();

    }
});

   btn4=new JButton("退出信息系统");
  btn4.addActionListener(new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent e) {
        int x=JOptionPane.showConfirmDialog(MyFrame04.this, "是否退出系统?", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
        if(x==JOptionPane.OK_OPTION){


            System.exit(0);
        }

    }
});

     add(btn1);
     add(btn2);
     add(btn3);
     add(btn4);

}

public JPanel getFilePanel(){
JPanel p=new JPanel();
p.setLayout(new FlowLayout());
p.add(new JLabel(“选择你要进行的操作!”));
return p;
}

public MyFrame04() {
JPanel cp=(JPanel) getContentPane();
cp.setLayout(new FlowLayout());

   cp.add(getFilePanel());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    init();
    add();
    setVisible(true);

}

}
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileReader;
import java.io.Reader;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
*
* 删除学生信息
*
* @author dd
*
*/
java课程设计学生信息管理系统。_第5张图片
public class MyFrame05 extends JFrame {
private JButton btn1;
private JButton btn2;

  private JTextField tf;

public void init() {

    setLayout(new FlowLayout());
    setTitle("学生信息删除系统");
    setSize(500, 500);
    setLocationRelativeTo(null);

}

public void add(){
     btn1=new JButton("确定");
        btn1.addActionListener(new ActionListener() {

            @Override


                public void actionPerformed(ActionEvent e) {

                        test02();


            }

        });


        btn2=new JButton("取消");
        btn2.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                new MyFrame04();
                MyFrame05.this.dispose();


            }
        });

    add(btn1);
    add(btn2);


}

public  JPanel getFilePanel(){
     JPanel p=new JPanel();
     p.setLayout(new FlowLayout());
     p.add(new JLabel("请输入要删除学生的名字"));
     tf=new JTextField(10);
     p.add(tf);
     return p;

}
public MyFrame05(){
    JPanel cp=(JPanel) getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(getFilePanel());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    add();
    init();

    setVisible(true);
}

public void test02(){
String name =”f:\学生信息\”+tf.getText()+”.txt”;
//File f=new File(name);
File f=new File(“f:\学生信息”);
String fname []=f.list();
File f1=new File(name);

boolean b=false;
for(String s:fname){

    if (s.equals(tf.getText()+".txt")) {    
        int y=JOptionPane.showConfirmDialog(MyFrame05.this, "是否删除",
        "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
        if (y==JOptionPane.OK_OPTION ) {
            f1.delete();

            JOptionPane.showConfirmDialog(MyFrame05.this, "删除成功", 
        "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
            MyFrame05.this.dispose();
            new MyFrame05();

            b=true;
        }

    }

     }
if(!b){
    JOptionPane.showConfirmDialog(MyFrame05.this, "是否删除?", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);

    JOptionPane.showConfirmDialog(MyFrame05.this, "删除失败:学生信息不存在", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
    MyFrame05.this.dispose();
    new MyFrame05();
}

}
}

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
* 查找
* @author dd
*
*/
java课程设计学生信息管理系统。_第6张图片
public class MyFrame06 extends JFrame {

private JButton btn1;
private JButton btn2;

  private JTextField tf;

public void init() {

    setLayout(new FlowLayout());
    setTitle("学生信息查看系统");
    setSize(500, 500);
    setLocationRelativeTo(null);

}

public void add(){
     btn1=new JButton("确定");
        btn1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                int x=JOptionPane.showConfirmDialog(MyFrame06.this, "是否查看", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
                if (x==JOptionPane.OK_OPTION) {
                try {
                    ck();
                    MyFrame06.this.dispose();
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }else{
                JOptionPane.showConfirmDialog(MyFrame06.this, "查看失败", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
                new MyFrame06();
            }
            }
        });


        btn2=new JButton("取消");
        btn2.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                MyFrame06.this.dispose();
                new MyFrame04();

            }
        });

    add(btn1);
    add(btn2);


}

public  JPanel getFilePanel(){
     JPanel p=new JPanel();
     p.setLayout(new FlowLayout());
     p.add(new JLabel("请输入要查找学生的名字"));
     tf=new JTextField(10);
     p.add(tf);
     return p;

}
public MyFrame06(){
    JPanel cp=(JPanel) getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(getFilePanel());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    add();
    init();

    setVisible(true);
}

public void ck() throws IOException {
    File f=new File("f:\\学生信息");
    String fname []=f.list();
    /*String a=null;*/
    boolean b=false;
    for(String s:fname){
        if (s.equals(tf.getText()+".txt")) {
            new MyFrame07(tf.getText()+".txt");
          b=true;
        }
        }
    if (!b) {
        JOptionPane.showConfirmDialog(MyFrame06.this, "查看失败:学生信息不存在", "系统提示", JOptionPane.OK_CANCEL_OPTION,JOptionPane.CANCEL_OPTION);
        new MyFrame06();
    }
        MyFrame06.this.dispose();

}

}

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
* 显示学生信息
* @author dd
*
*/
java课程设计学生信息管理系统。_第7张图片
public class MyFrame07 extends JFrame {

 private String xb;
 private String bj;
 private String dh;
 private String sj;
 private String dzyx;
 private String txdz;
 private String yzbm;

 private JButton btn1;
private JButton btn2;




    public void init() {

        setLayout(new FlowLayout());
        setTitle("学生信息");
        setSize(500, 500);
        setLocationRelativeTo(null);


    }

   public void add(){
         btn1=new JButton("退出");
            btn1.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {

                    System.exit(0);
                }
            });


            btn2=new JButton("返回");
            btn2.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    MyFrame07.this.dispose();
                    new MyFrame06();

                }
            });


   }


public MyFrame07(String name) throws IOException {


    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    init();
     add();
     dq(name);
setVisible(true);

JPanel p=new JPanel();
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JPanel p3=new JPanel();
JPanel p4=new JPanel();
setContentPane(p);

p.setLayout(new BorderLayout());
p1.setLayout(new GridLayout(8,1));
p2.setLayout(new FlowLayout());

p1.add(new JLabel(w0));
p1.add(new JLabel(w1));
p1.add(new JLabel(w2));
p1.add(new JLabel(w3));
p1.add(new JLabel(w4)); 
p1.add(new JLabel(w5));
p1.add(new JLabel(w6));
p1.add(new JLabel(w7));
p2.add(btn1);
p2.add(btn2);

p.add(p1,BorderLayout.CENTER);
p.add(p2,BorderLayout.SOUTH);
p.add(p3,BorderLayout.EAST);
p.add(p4,BorderLayout.WEST);
}
String w0=null;
String w1=null;
String w2=null;
String w3=null;
String w4=null;
String w5=null;
String w6=null;
String w7=null;
 public  void dq(String name) throws IOException{
    File f=new File("f:\\学生信息");
    String fname []=f.list();

        Reader r=new FileReader("f:\\学生信息\\"+name);
        String b=null;
        char cs[]=new char[1024*1024];
        int len=0;
        while ((len=r.read(cs))!=-1) {
            b=new String(cs,0,len);
        }
        r.close();

        String[] s=b.split("。");
        w0=s[0];
        w1=s[1];
        w2=s[2];
        w3=s[3];
        w4=s[4];
        w5=s[5];
        w6=s[6];
        w7=s[7];

}
            }

你可能感兴趣的:(java课程设计学生信息管理系统。)