5.删除 点击
,弹出如下窗口:
当输入的学号不存在时,会弹出提示:
当删除成功时,弹出窗口:
6.退出 点击
,退出学籍管理系统。
5 主要程序代码及说明
1.菜单部分代码:
package XSXJGL;
import java.awt.Container; import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*;
import javax.swing.JButton; import javax.swing.JFrame;
import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class Menu {
JFrame jf;
JButton j1,j2, j3, j4, j5,j6;
public static void main(String args[]){ Menu m =new Menu(); m.go(); }
public void go(){
jf=new JFrame(\学生学籍管理系统\ jf.setBounds(200, 200, 300, 200); Container cp=jf.getContentPane();
cp.setLayout(new FlowLayout(FlowLayout.LEADING,20,20)); j1=new JButton(\添加学生信息\ j2=new JButton(\修改学生信息\ j3=new JButton(\查询学生信息\ j4=new JButton(\删除学生信息\ j5=new JButton(\显示学生信息\ j6=new JButton(\退出管理系统\ cp.add(j1); cp.add(j2); cp.add(j3); cp.add(j4); cp.add(j5);
cp.add(j6);
j1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){ new Add(); } });
j2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Modify modify=new Modify(); } });
j3.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Search search=new Search(); } });
j4.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Delete delete=new Delete(); } });
j5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){ Display display=new Display(); } });
j6.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ System.exit(0); } });
jf.setVisible(true); } }
2.登录部分代码:
package XSXJGL;
import java.awt.Dimension; import java.awt.Toolkit;
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;