> * *JAVA大作业 | 学生成绩管理系统(含有用户界面)***

————- ps :多个包写在一起———–

package test;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.ArrayList;class person{public String name;public String age;
}class Student extends person{public String no;public String score1,score2,score3,score4;public Student(String no, String name, String age,String score1,String score2,String score3,String score4) {this.no = no;this.name = name;this.age = age;this.score1 = score1;  this.score2 = score2; this.score3 = score3;this.score4 = score4; }public String getNo() {return this.no;}public void setNo(String no) {this.no = no;}public String getName() {return this.name;}public void setName(String name) {this.name = name;}public String getAge() {return this.age;}public void setAge(String age) {this.age = age;}public String getscore1() {return this.score1;}public void setscore1(String score1) {this.score1 = score1;}public String getscore2() {return this.score2;}public void setscore2(String score2) {this.score2 = score2;}public String getscore3() {return this.score3;}public void setscore3(String score3) {this.score3 = score3;}public String getscore4() {return this.score4;}public void setscore4(String score4) {this.score4 = score4;}}class Class{ArrayList<Student> stuList;public Class(){this.stuList=new ArrayList<>();}public void addStudent(Student stu){this.stuList.add(stu);}public void deleteStudent(Student s){this.stuList.remove(s);}
}class menu extends JFrame{public menu(){  this.setBounds(300, 150, 500, 450);this.setTitle("大连海事大学 -- --学生信息管理系统");this.setLayout(null);JLabel labTipw = new JLabel("欢迎进入 大连海事大学 学生信息管理系统");labTipw.setBounds(50, 2, 250, 45);JLabel labTipws = new JLabel("(*新用户初始密码为  身份证后六位数字)");labTipws.setBounds(50, 15, 250, 45);JLabel labyonghu = new JLabel("用户名:");labyonghu.setBounds(50, 60, 100, 50);JTextField txtyonghu = new JTextField("请输入登录用户名:",30);txtyonghu.setBounds(130, 76, 180, 30);        JLabel  labmima = new JLabel("密码:");labmima.setBounds(50, 100, 50, 50);JTextField txtmima = new JTextField("请输入登录6位密码:",30);txtmima.setBounds(130, 117, 180, 30);JButton btndianji = new JButton("点击登录"); btndianji.setBounds(130, 165, 180, 30);btndianji.setForeground(Color.BLUE);this.add(labTipw);this.add(labTipws);this.add(labyonghu);this.add(txtyonghu);this.add(labmima);this.add(txtmima);this.add(btndianji);btndianji.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new StudentFrame();}} );setVisible(true);}
}public class StudentFrame extends JFrame {Class c = new Class();JLabel labNo;JLabel labName;JLabel labAge;JLabel labscore1;JLabel labscore2;JLabel labscore3;JLabel labscore4;JLabel labTip;JLabel labavr;JTextField txtNo;JTextField txtName;JTextField txtAge;JTextField txtscore1;JTextField txtscore2;JTextField txtscore3;JTextField txtscore4;JTextField txtavr;JButton btnAdd;JButton btnRemove;JButton btnModify;JButton btnClear;JButton btnFirst;JButton btnPrev;JButton btnNext;JButton btnLast;JButton btnCheck;JOptionPane dialog;public StudentFrame() {this.setBounds(300, 100, 650, 530);this.setTitle("大连海事大学 -- --学生信息管理系统");this.setLayout(null);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);studentin(); addStu();firstStudent();lastStudent();previous();next();remove();check();modify();clear();this.setVisible(true);    }public void studentin() {labTip = new JLabel("登陆成功 !您已经进入管理系统(仅输入学号便可查找学生信息).");labTip.setBounds(50, 2, 550, 45);    labNo = new JLabel("学生学号:");            labNo.setBounds(50, 20, 100, 50);txtNo = new JTextField("请输入6位学号:",30);txtNo.setBounds(130, 35, 180, 30);              labName = new JLabel("学生姓名:");labName.setBounds(50, 60, 100, 50);txtName = new JTextField("请输入学生姓名:",30);txtName.setBounds(130, 76, 180, 30);        labAge = new JLabel("班级:");labAge.setBounds(50, 100, 50, 50);txtAge = new JTextField("请输入学生所在班级:",30);txtAge.setBounds(130, 117, 180, 30);labscore1 = new JLabel("JAVA 成绩:");         labscore1.setBounds(50, 140, 100, 50);txtscore1 = new JTextField("请输入学生成绩:",30);txtscore1.setBounds(130, 158, 180, 30);labscore2 = new JLabel("C语言成绩:");           labscore2.setBounds(50, 189, 100, 50);txtscore2 = new JTextField("请输入学生成绩:",30);txtscore2.setBounds(130, 199, 180, 30);labscore3 = new JLabel("Python成绩:");            labscore3.setBounds(50, 230, 100, 50);txtscore3 = new JTextField("请输入学生成绩:",30);txtscore3.setBounds(130, 240, 180, 30);labscore4 = new JLabel("C++ 成绩:");          labscore4.setBounds(50, 290, 100, 50);txtscore4 = new JTextField("请输入学生成绩:",30);txtscore4.setBounds(130, 301, 180, 30);labavr = new JLabel("操作说明  ** |<< : 第一个学生信息    <:上一位学生信息   >:下一个学生信息  >>|:最后一个学生信息");labavr.setBounds(50, 330, 580, 50);btnAdd = new JButton("添加");btnAdd.setBounds(50, 385, 80, 20);btnAdd.setForeground(Color.BLACK);btnModify = new JButton("修改");btnModify.setBounds(150, 385, 80, 20);btnModify.setForeground(Color.BLUE);btnRemove = new JButton("删除");btnRemove.setBounds(250, 385, 80, 20);btnRemove.setForeground(Color.RED);btnClear = new JButton("清空");btnClear.setBounds(350, 385, 80, 20);btnClear.setForeground(Color.GREEN);btnCheck = new JButton("查找信息");btnCheck.setBounds(350, 145, 160, 50);btnCheck.setForeground(Color.BLACK);btnFirst = new JButton("|<<");btnFirst.setBounds(50, 432, 80, 20);btnFirst.setForeground(Color.PINK);btnPrev = new JButton("<");btnPrev.setBounds(150, 432, 80, 20);btnPrev.setForeground(Color.BLACK);btnNext = new JButton(">");btnNext.setBounds(250, 432, 80, 20);btnNext.setForeground(Color.BLACK);btnLast = new JButton(">>|");btnLast.setBounds(350, 432, 80, 20);btnLast.setForeground(Color.PINK);this.add(labNo);this.add(labName);this.add(labAge);this.add(labscore1);this.add(txtNo);this.add(labTip);this.add(txtName);this.add(txtAge);this.add(txtscore1);this.add(btnAdd);this.add(btnRemove);this.add(btnModify);this.add(btnClear);this.add(btnFirst);this.add(btnPrev);this.add(btnNext);this.add(btnLast);this.add(btnCheck);this.add(labavr);this.add(labscore2);this.add(txtscore2);this.add(labscore3);this.add(txtscore3); this.add(labscore4);this.add(txtscore4);}public boolean blank() {if (txtNo.getText().equals("")) {dialog.showMessageDialog(null, "学号输入有误 请重新输入!");return false;}if (txtName.getText().equals("")) {dialog.showMessageDialog(null, "名字输入有误 请重新输入!");return false;}if (txtAge.getText().equals("")) {dialog.showMessageDialog(null, "班级输入有误 请重新输入!");return false;}if (txtscore1.getText().equals("")) {dialog.showMessageDialog(null, "成绩输入有误 请重新输入!");return false;}if (txtscore2.getText().equals("")) {dialog.showMessageDialog(null, "成绩输入有误 请重新输入!");return false;}if (txtscore3.getText().equals("")) {dialog.showMessageDialog(null, "成绩输入有误 请重新输入!");return false;}if (txtscore4.getText().equals("")) {dialog.showMessageDialog(null, "成绩输入有误 请重新输入!");return false;}return true;}public void addStu() {btnAdd.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (blank() == true) {c.addStudent(new Student(txtNo.getText(), txtName.getText(), txtAge.getText(),txtscore1.getText(),txtscore2.getText(),txtscore3.getText(),txtscore4.getText()));dialog.showMessageDialog(null, "学生信息已添加成功");}}});}public void firstStudent() {     btnFirst.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {txtNo.setText(c.stuList.get(0).getNo());txtName.setText(c.stuList.get(0).getName());txtAge.setText(c.stuList.get(0).getAge());txtscore1.setText(c.stuList.get(0).getscore1());txtscore2.setText(c.stuList.get(0).getscore2());txtscore3.setText(c.stuList.get(0).getscore3());txtscore4.setText(c.stuList.get(0).getscore4());}});}public void lastStudent() {btnLast.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {txtNo.setText(c.stuList.get(c.stuList.size() - 1).getNo());txtName.setText(c.stuList.get(c.stuList.size() - 1).getName());txtAge.setText(c.stuList.get(c.stuList.size() - 1).getAge());txtscore1.setText(c.stuList.get(c.stuList.size() - 1).getscore1());txtscore2.setText(c.stuList.get(c.stuList.size() - 1).getscore2());txtscore3.setText(c.stuList.get(c.stuList.size() - 1).getscore3());txtscore4.setText(c.stuList.get(c.stuList.size() - 1).getscore4());}});}public void previous() {btnPrev.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {int n = 0;for (int i = 0; i < c.stuList.size(); i++) {if (c.stuList.get(i).getNo().equals(txtNo.getText())) {n = i - 1;}}if (c.stuList.get(0).getNo().equals(txtNo.getText())) {dialog.showMessageDialog(null, "再无上一个学生");} else {txtNo.setText(c.stuList.get(n).getNo());txtName.setText(c.stuList.get(n).getName());txtAge.setText(c.stuList.get(n).getAge());txtscore1.setText(c.stuList.get(n).getscore1());txtscore2.setText(c.stuList.get(n).getscore2());txtscore3.setText(c.stuList.get(n).getscore3());txtscore4.setText(c.stuList.get(n).getscore4());}}});}public void next() {btnNext.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {int n = 0;for (int i = 0; i < c.stuList.size(); i++) {if (c.stuList.get(i).getNo().equals(txtNo.getText())) {n = i + 1;}}if (c.stuList.get(c.stuList.size() - 1).getNo().equals(txtNo.getText())) {dialog.showMessageDialog(null, "再无下一个学生");} else {txtNo.setText(c.stuList.get(n).getNo());txtName.setText(c.stuList.get(n).getName());txtAge.setText(c.stuList.get(n).getAge());txtscore1.setText(c.stuList.get(n).getscore1());txtscore2.setText(c.stuList.get(n).getscore2());txtscore3.setText(c.stuList.get(n).getscore3());txtscore4.setText(c.stuList.get(n).getscore4());}}});}public void remove() {btnRemove.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (c.stuList.size() == 0) {JOptionPane.showMessageDialog(null, "没有该学生信息");} else {Student s = new Student(txtNo.getText(), txtName.getText(), txtAge.getText(),txtscore1.getText(),txtscore2.getText(),txtscore3.getText(),txtscore4.getText());if (blank() == true) {System.out.println(c.stuList.contains(s));System.out.println(s);if (!c.stuList.contains(s)) {c.deleteStudent(s);JOptionPane.showMessageDialog(null, "已经删除成功");int a = 0;for (int i = 0; i < c.stuList.size(); i++) {if (c.stuList.get(i).getNo().equals(txtNo.getText())) {a = i + 1;}}if (c.stuList.size() > 0) {if (c.stuList.get(c.stuList.size() - 1).getNo().equals(txtNo.getText())) {txtNo.setText(c.stuList.get(0).getNo());txtName.setText(c.stuList.get(0).getName());txtAge.setText(c.stuList.get(0).getAge());txtscore1.setText(c.stuList.get(0).getscore1());txtscore2.setText(c.stuList.get(0).getscore2());txtscore3.setText(c.stuList.get(0).getscore3());txtscore4.setText(c.stuList.get(0).getscore4());} else {txtNo.setText(c.stuList.get(a).getNo());txtName.setText(c.stuList.get(a).getName());txtAge.setText(c.stuList.get(a).getAge());txtscore1.setText(c.stuList.get(a).getscore1());txtscore2.setText(c.stuList.get(a).getscore2());txtscore3.setText(c.stuList.get(a).getscore3());txtscore4.setText(c.stuList.get(a).getscore4());}} else {clear();}} else {dialog.showMessageDialog(null, "未来找到对应学生的信息");  }}}}});}public void modify() {btnModify.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (c.stuList.size() == 0) {dialog.showMessageDialog(null, "没有该学生信息");}for (Student s : c.stuList) {if (s.getNo().equals(txtNo.getText())) {if (blank() == true) {s.setName(txtName.getText());s.setAge(txtAge.getText());JOptionPane.showMessageDialog(null, "已经修改成功");return;}}}JOptionPane.showMessageDialog(null, "修改失败请重新操作");}});}public void check() {btnCheck.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if ((txtNo.getText().equals(""))) {dialog.showMessageDialog(null, "学号不能为空 请从新输入");} else {int m = 0;for (int i = 0; i < c.stuList.size(); i++) {if (c.stuList.get(i).getNo().equals(txtNo.getText())) {JOptionPane.showMessageDialog(null, "已查到该学生信息");txtName.setText(c.stuList.get(i).getName());txtAge.setText(c.stuList.get(i).getAge());txtscore1.setText(c.stuList.get(i).getscore1());txtscore2.setText(c.stuList.get(i).getscore2());txtscore3.setText(c.stuList.get(i).getscore3());txtscore4.setText(c.stuList.get(i).getscore4());break;}m++;}if (m == c.stuList.size()) {dialog.showMessageDialog(null, "没有此学生的相关信息");return;  }}}});}public void clear() {btnClear.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {txtNo.setText("");txtName.setText("");txtAge.setText("");txtscore1.setText("");txtscore2.setText("");txtscore3.setText("");txtscore4.setText("");}});}    public static void main(String[] args) {new menu();             }
}

JAVA大作业 | 学生成绩信息管理系统相关推荐

  1. 哈工大C语言大作业-学生成绩管理系统

    哈工大C语言大作业-学生成绩管理系统 完整项目地址:https://github.com/944613709/Student-Performance-Management-System-ByC 说明 ...

  2. 基于JavaWeb学生成绩信息管理系统(附源码资料)-毕业设计

    1. 适用人群 本课程主要是针对计算机专业相关正在做毕业设计.或者是需要实战项目的Java开发学习者. 2. 你将收获 提供:项目源码.项目文档.数据库脚本.软件工具等所有资料(在平台的课程附件中进行 ...

  3. C语言编写学生成绩信息管理系统

    用C语言设计简单的学生成绩信息管理系统 介绍 代码 结构体数组的定义 home_page() 函数 add_infor() 函数 browse_infor() 函数 find_infor() 函数 m ...

  4. JAVA计算机毕业设计学生学籍信息管理系统Mybatis+源码+数据库+lw文档+系统+调试部署

    JAVA计算机毕业设计学生学籍信息管理系统Mybatis+源码+数据库+lw文档+系统+调试部署 JAVA计算机毕业设计学生学籍信息管理系统Mybatis+源码+数据库+lw文档+系统+调试部署 本源 ...

  5. java毕业生设计学生学籍信息管理系统计算机源码+系统+mysql+调试部署+lw

    java毕业生设计学生学籍信息管理系统计算机源码+系统+mysql+调试部署+lw java毕业生设计学生学籍信息管理系统计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构:B/S ...

  6. java计算机毕业设计学生学籍信息管理系统源码+mysql数据库+lw文档+系统+调试部署

    java计算机毕业设计学生学籍信息管理系统源码+mysql数据库+lw文档+系统+调试部署 java计算机毕业设计学生学籍信息管理系统源码+mysql数据库+lw文档+系统+调试部署 本源码技术栈: ...

  7. 【基于SSM+MySQL+Jsp的高校学生成绩信息管理系统的设计与实现 ---(效果+源代码+数据库+获取 ~ ~】

    快速阅读目录 写在前面: (一)效果展示 (1)数据库表一览 (2)部分运行截图 (二)代码展示 (三)说明 写在前面: tips:这是一个基于SSM+MySQL+Jsp等技术的高校学生成绩信息管理系 ...

  8. 任务2 学生成绩信息管理系统

    系列文章 任务2 学生成绩信息管理系统 某班级学生C语言第一次正考的成绩存于数据文件score.txt中,记录了学生学号.姓名和考试成绩,bk.txt文件中记录了补考学生的学号.姓名和补考成绩,编写程 ...

  9. JAVA计算机毕业设计学生学籍信息管理系统计算机(附源码、数据库)

    JAVA计算机毕业设计学生学籍信息管理系统计算机(附源码.数据库) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Ecl ...

最新文章

  1. Oracle报错createPool,Jmeter中连接Oracle报错Cannot create PoolableConnectionFactory
  2. 划分VLAN将生成树协议中的阻塞端口设置为转发端口
  3. Webapi测试工具WebBenchmark v1.3发布
  4. uva 11396Claw Decomposotion(二分图判定)
  5. mysql load source_再说说LOAD和SOURCE
  6. CSS BACKGROUND汇总
  7. Xshell 、PuTTY 复制文件到Linux
  8. Avro, Protocol Buffers 、Thrift的联系与区别
  9. MAC电脑配置环境变量
  10. 鸡你太美,用大数据扒一扒蔡徐坤的真假流量粉
  11. 日版IPhone5完美上3G
  12. 车架号 生成 java_车辆识别码VIN校验位计算方法及实现  VIN号检验、车架号检验 java、 C++...
  13. 50欧姆系统的由来的小故事
  14. HDU 6078 Wavel Sequence
  15. 简单的python抢红包脚本-Python自动抢红包,超详细教程,再也不会错过微信红包了...
  16. Chemdraw 基础操作【图文】
  17. 玩游戏4g计算机的内存不足,别再说内存不足了!教你一招彻底解决,电脑运行加速3倍!...
  18. 好神奇:衣服也能存储数据啦
  19. api和gataway
  20. 从概念到现状,一文读懂边缘计算

热门文章

  1. 利用阿里云轻量服务器实现frp内网穿透(Mac远程控制win)
  2. 包包各部位名称图解_包包各个部位的英文表达
  3. 2014年12月30日,31日,2015年1月3日,4日
  4. 进化算法及Python实现(使用DEAP库)
  5. Java——成绩等级评定
  6. 三人分糖果c语言,C语言顺序结构 -C语言桐桐分糖果问题(附带源码)
  7. 软件工程 Shari Lawrence Chapter01
  8. 老男人生育的子女智商低
  9. mysql安装包安装_mysql安装包安装
  10. Python 在连接数据库的时候报错