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

📄 studentmanager.java

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


import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.io.*;


public class StudentManager extends JFrame implements ActionListener

{
    
    int i;

   StudentSituation 基本信息录入=null;          

   ModifySituation  基本信息修改=null;          

   Inquest          基本信息查询=null; 

   Delete           基本信息删除=null; 
   
   View             全部信息查看=null;
   
   JMenuBar bar;

   JMenu fileMenu;

   JMenuItem 录入,修改,查询,删除,查看;      

   Container con=null;                    

   File file=null;                             

   CardLayout card=null;
   
   Lianbiao 基本信息[]=new Lianbiao[100];

   JLabel label=null;                          

   JPanel pCenter;

   public StudentManager()

   {

     录入=new JMenuItem("录入学生基本信息");

     修改=new JMenuItem("修改学生基本信息");

     查询=new JMenuItem("查询学生基本信息");

     删除=new JMenuItem("删除学生基本信息");
     
     查看=new JMenuItem("全部学生信息查看");

     bar=new JMenuBar();

     fileMenu=new JMenu("菜单选项");

     fileMenu.add(录入);

     fileMenu.add(修改);

     fileMenu.add(查询);

     fileMenu.add(删除);
     
     fileMenu.add(查看);

     bar.add(fileMenu);

     setJMenuBar(bar);

     label=new JLabel("欢迎使用电信系学生信息管理系统",JLabel.CENTER);

     label.setFont(new Font("TimesRoman",Font.BOLD,24));

     label.setForeground(Color.green);
     
     for(i=0;i<100;i++)
     {    

          基本信息[i]=new Lianbiao();
     
     }

     录入.addActionListener(this);

     修改.addActionListener(this);

     查询.addActionListener(this);

     删除.addActionListener(this);
     
     查看.addActionListener(this);

     card=new CardLayout();

     con=getContentPane();

     pCenter=new JPanel();

     pCenter.setLayout(card); 

     file=new File("基本信息.student");


     if(!file.exists())

      {

       try{

           FileOutputStream out=new FileOutputStream(file);

           ObjectOutputStream objectOut=new ObjectOutputStream(out);
                        
           objectOut.writeObject(基本信息);

           objectOut.close();

           out.close();

          }

       catch(IOException e)

          {

          }

      } 

     基本信息录入=new StudentSituation(file);

     基本信息修改=new ModifySituation(file);

     基本信息查询=new Inquest(this,file);

     基本信息删除=new Delete(file);
     
     全部信息查看=new View(file);

     pCenter.add("欢迎语界面",label);

     pCenter.add("录入界面",基本信息录入);

     pCenter.add("修改界面",基本信息修改);    

     pCenter.add("删除界面",基本信息删除);
     
     pCenter.add("查看界面",全部信息查看);


     con.add(pCenter,BorderLayout.CENTER);

     con.validate();

     addWindowListener(new WindowAdapter()

                    { public void windowClosing(WindowEvent e)

                       {

                          System.exit(0);

                         }

                    });

    setVisible(true);

    setBounds(100,50,420,380);

    validate();

   }

  public void actionPerformed(ActionEvent e)

   {

     if(e.getSource()==录入)

       {

         card.show(pCenter,"录入界面");

       }

     else if(e.getSource()==修改)

       {

         card.show(pCenter,"修改界面");

       }

     else if(e.getSource()==查询)

      {

         基本信息查询.setVisible(true);

      }

     else if(e.getSource()==删除)

      {

         card.show(pCenter,"删除界面");

      }
     
      else if(e.getSource()==查看)

      {

         card.show(pCenter,"查看界面");

      }

   }
    public static void main(String[] args)
  {
       new StudentManager();
   }    
}

⌨️ 快捷键说明

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