⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view.java

📁 ——学生信息系统的设计与实现—— 以学生信息为背景
💻 JAVA
字号:


package student;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.io.*;


public class View extends JPanel implements ActionListener

{ 
   int i; 
    
   JButton j1,j2;
     
   FileInputStream inOne=null;

   ObjectInputStream inTwo=null;

  
  Lianbiao 基本信息[]=new Lianbiao[100];    
 public  static Lianbiao 基本信息1[]=new Lianbiao[100];

 
    File file=null;                 
    
    public View(File file) {
       for(i=0;i<100;i++)
         {    

            基本信息[i]=new Lianbiao();
     
          }
       
           for(i=0;i<100;i++)
         {    

           基本信息1[i]=new Lianbiao();
     
          }
       
       this.file=file;
       
       j1=new JButton("按学号查看");

       j1.addActionListener(this);
 
       j2=new JButton("按姓名查看");

       j2.addActionListener(this); 
      
       Box box1=Box.createHorizontalBox();              

       box1.add(j1);
      
      Box box2=Box.createHorizontalBox();              

      box1.add(j2);
      
     Box boxH=Box.createVerticalBox();              

    boxH.add(box1);

    boxH.add(box2);
   
    boxH.add(Box.createVerticalGlue());           

    JPanel pCenter=new JPanel();

    pCenter.add(boxH);

    setLayout(new BorderLayout());

    add(pCenter,BorderLayout.CENTER);
   
     validate();
      
    }
    
    public void actionPerformed(ActionEvent e)
    {
           if(e.getSource()==j1)
           {
                    try {

                    inOne=new FileInputStream(file);

                    inTwo=new ObjectInputStream(inOne);

                    基本信息=(Lianbiao[])inTwo.readObject();

                    inOne.close();

                    inTwo.close();

                     }

               catch(Exception ee)

                   {

                   }
                    
               基本信息1=基本信息.clone()  ;
               Lianbiao.pn(基本信息1);
               new ColumnModelTest(); 
                    
                    
           }
                     if(e.getSource()==j2)
           {
                    try {

                    inOne=new FileInputStream(file);

                    inTwo=new ObjectInputStream(inOne);

                    基本信息=(Lianbiao[])inTwo.readObject();

                    inOne.close();

                    inTwo.close();

                     }

               catch(Exception ee)

                   {

                   }
                    
               基本信息1=基本信息.clone()  ;
               Lianbiao.pa(基本信息1);
               new ColumnModelTest(); 
                    
                    
           }
    }
    
    public static  Lianbiao[] GetL()
    {
        return 基本信息1;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -