版权声明:原创不易,本文禁止抄袭、转载,侵权必究!

目录

一、需求开发文档

二、数据库设计文档

三、功能模块部分代码及效果展示

四、完整源码下载

五、作者Info

一、需求开发文档

项目完整文件列表:

需求开发文档部分截图:


二、数据库设计文档

数据库设计文档部分截图:


三、功能模块部分代码及效果展示

数据库类:

 1 package system_of_database;
2
3 import java.sql.Connection;
4 import java.sql.DriverManager;
5 import java.sql.PreparedStatement;
6 import java.sql.ResultSet;
7 import java.sql.SQLException;
8
9 public class DBUtil {
10
11 Connection con = null;
12 PreparedStatement ps = null;
13 ResultSet rs = null;
14
15 public Connection getConnection() throws ClassNotFoundException,
16 SQLException,InstantiationException,IllegalAccessException {
17 String driver = "com.mysql.jdbc.Driver";
18 String url = "jdbc:mysql://localhost:3306/exam_of_students?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false";
19 String user = "root";
20 String password = "root";
21 try {
22 Class.forName(driver);
23 con = DriverManager.getConnection(url,user,password);
24 return con;
25 } catch(Exception e) {
26 throw new SQLException("驱动错误或连接失败!");
27 }
28 }

考生登录部分代码如下:

 1 public class LoginListener implements ActionListener{
2 public void actionPerformed(ActionEvent e) {
3 lblMsg1.setText("");
4 lblMsg2.setText("");
5 user = userService.findUserByName(txtName.getText().trim());
6 if(user != null) {
7 if(user.getPassword().equals(new String(txtPwd.getPassword()))) {
8 LoginFrame_Of_Students.this.setVisible(false);
9 new MainFrame_Of_Students();
10 } else {
11 lblMsg2.setText("密码错误!");
12 txtPwd.setText("");
13 }
14 } else {
15 lblMsg1.setText("该考生不存在 !");
16 }
17 }
18 }

考生登录效果如下:

管理员登录部分代码如下:

 1 public class LoginListener implements ActionListener{
2 public void actionPerformed(ActionEvent e) {
3 lblMsg1.setText("");
4 lblMsg2.setText("");
5 user = userService.findUserByName(txtName.getText().trim());
6 if(user != null) {
7 if(user.getPassword().equals(new String(txtPwd.getPassword()))) {
8 LoginFrame_Of_Administration.this.setVisible(false);
9 new MainFrame_Of_Administration();
10 } else {
11 lblMsg2.setText("密码错误!");
12 txtPwd.setText("");
13 }
14 } else {
15 lblMsg1.setText("该管理员不存在 !");
16 }
17 }
18 }
19
20 public class ResetListener implements ActionListener{
21 public void actionPerformed(ActionEvent e) {
22 txtName.setText("");
23 txtPwd.setText("");
24 }
25 }

管理员登录效果如下:

考生查询成绩部分代码如下:

 1 private void showData() {
2 String id = txtId.getText();
3 String sql = "select id as 考生号,geography as 地理,chemistry as 化学,IT as 信息技术,History as 历史 ,Biology as 生物,mathematics as 数学,general_technique as 通用技术,physics as 物理,english as 英语,chinese as 语文,politics as 政治 from information_of_grade where id = '"+id+"'";
4 DBUtil db = new DBUtil();
5 try {
6 db.getConnection();
7 ResultSet rs = db.executeQuery(sql, null);
8 ResultSetMetaData rsmd = rs.getMetaData();
9 int colCount = rsmd.getColumnCount();
10 Vector<String> title = new Vector<String>(); //存放标题
11 for(int i = 1;i<=colCount;i++) {
12 title.add(rsmd.getColumnLabel(i));
13 }
14 Vector<Vector<String>> data = new Vector<Vector<String>>(); //存放表格数据
15 int rowCount = 0;
16 while(rs.next()) {
17 rowCount++;
18 Vector<String> rowdata = new Vector<String>(); //存放行数据
19 for(int i = 1;i<=colCount;i++) {
20 rowdata.add(rs.getString(i));
21 }
22 data.add(rowdata);
23 }
24 if(rowCount == 0) {
25 model.setDataVector(null, title);
26 } else {
27 model.setDataVector(data,title);
28 }
29 } catch(Exception ee) {
30 System.out.println(ee.toString());
31 JOptionPane.showMessageDialog(this, "系统出现异常错误。请检查数据库。系统即将推出!!!","错误",0);
32 } finally {
33 db.closeAll();
34 }
35 JOptionPane.showMessageDialog(null, "查询到该考生信息");
36 }

考生查询成绩效果如下:

考生成绩导出部分代码如下:

 1 public void saveFile() {
2 JFileChooser fc = new JFileChooser();
3 int rVal = fc.showSaveDialog(this);
4 if(rVal == JFileChooser.APPROVE_OPTION) {
5 String fileName = fc.getSelectedFile().getName();
6 String path = fc.getCurrentDirectory().toString();
7 try {
8 TableModel model = table.getModel();
9 FileWriter fw = new FileWriter(path + "/" + fileName);
10 for(int i=0; i < model.getColumnCount(); i++) {
11 fw.write(model.getColumnName(i) + "\t");
12 }
13 fw.write("\n");
14 for(int i=0; i< model.getRowCount(); i++) {
15 for(int j=0; j < model.getColumnCount(); j++) {
16 fw.write(model.getValueAt(i,j).toString()+"\t");
17 }
18 fw.write("\n");
19 }
20 fw.close();
21 } catch(Exception e) {
22 e.printStackTrace();
23 }
24 JOptionPane.showMessageDialog(null, "导出成功");
25 }
26 }

考生成绩导出效果如下:

考生修改密码部分代码如下:

 1 public class listener_of_delete implements ActionListener{
2 public void actionPerformed(ActionEvent e){
3 String id = jtId.getText();
4 String code = new String(jpCode.getPassword());
5 String code1 = new String(jpCode1.getPassword());
6 DBUtil db = new DBUtil();
7 String sql = "update information_of_students set pwd = '"+code+"' where id = '"+id+"'";
8 if(code.equals(code1)){
9 try {
10 db.getConnection();
11 db.executeUpdate(sql,null);
12 } catch(Exception ee) {
13 System.out.println(ee.toString());
14 } finally {
15 db.closeAll();
16 }
17 JOptionPane.showMessageDialog(null, "修改成功");
18 }
19 else{
20 JOptionPane.showMessageDialog(null, "两次密码不一样!");
21 }
22 }
23 }

考生修改密码效果如下:

管理员主面板部分代码如下:

 1 public MainFrame_Of_Administration() {
2 super("Administration");
3 ImageIcon qstIcon = new ImageIcon("images\\1.png");
4 this.setIconImage(qstIcon.getImage());
5 p = new JPanel();
6 setBak();
7 clipboard=getToolkit().getSystemClipboard();
8 Container c = getContentPane();
9 p.setOpaque(false);
10 c.add(p);
11 p.setLayout(null);
12
13 jbInsert = new JButton("添加考生信息");
14 jbDelete = new JButton("删除考生信息");
15 jbUpdate = new JButton("修改考生信息");
16 jbAdministration = new JButton("返回登录界面");
17 jbResetCode = new JButton("重置考生密码");
18
19 jbAdministration.addActionListener(new loginframe_of_administration());
20 jbDelete.addActionListener(new listener_of_delete());
21 jbInsert.addActionListener(new listener_of_insert());
22 jbUpdate.addActionListener(new listener_of_update());
23 jbResetCode.addActionListener(new listener_of_reset());
24
25 jbInsert.setBounds(0,20,120,25);
26 jbDelete.setBounds(0,55,120,25);
27 jbUpdate.setBounds(0,90,120,25);
28 jbAdministration.setBounds(0,125,120,25);
29 jbResetCode.setBounds(0,165,120,25);
30
31 p.add(jbInsert);
32 p.add(jbDelete);
33 p.add(jbUpdate);
34 p.add(jbAdministration);
35 p.add(jbResetCode);
36 this.add(p);
37 this.setLocation(200,100);
38 this.setSize(533,300);
39 this.setResizable(false);
40 this.setVisible(true);
41 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
42
43 }

管理员主面板效果如下:

添加考生信息部分代码如下:

 1 public class listener_of_insert implements ActionListener{
2 public void actionPerformed(ActionEvent e){
3 DBUtil db = new DBUtil();
4 String preparedsql = "insert into information_of_grade(id,geography,chemistry,IT,history,biology,mathematics,general_technique,physics,english,chinese,politics)"+"values(?,?,?,?,?,?,?,?,?,?,?,?)";
5
6 try {
7 db.getConnection();
8 Object param[] = {jtId.getText(),jtGeo.getText(),jtChe.getText(),jtIT.getText(),jtHis.getText(),jtBio.getText(),jtMath.getText(),jtGen.getText(),jtPhy.getText(),jtEng.getText(),jtChi.getText(),jtPol.getText()};
9 db.executeUpdate(preparedsql, param);
10 } catch(Exception ee) {
11 System.out.println(ee.toString());
12 } finally {
13 db.closeAll();
14 }
15 JOptionPane.showMessageDialog(null, "成功添加考生信息");
16 }
17 }

添加考生信息效果如下:

删除考生信息部分代码如下:

 1 public class listener_of_delete implements ActionListener{
2 public void actionPerformed(ActionEvent e){
3 String id = jtId.getText();
4 DBUtil db = new DBUtil();
5 String sql = "delete from information_of_grade where id = '"+id+"'";
6
7 try {
8 db.getConnection();
9 db.executeUpdate(sql,null);
10 } catch(Exception ee) {
11 System.out.println(ee.toString());
12 } finally {
13 db.closeAll();
14 }
15 JOptionPane.showMessageDialog(null, "成功删除考生信息");
16 }
17 }

删除考生信息效果如下:

修改考生信息部分代码如下:

 1 public class listener_of_delete implements ActionListener{
2 public void actionPerformed(ActionEvent e){
3 String id = jtId.getText();
4 String code = new String(jpCode.getPassword());
5 String code1 = new String(jpCode1.getPassword());
6 DBUtil db = new DBUtil();
7 String sql = "update information_of_students set pwd = '"+code+"' where id = '"+id+"'";
8 if(code.equals(code1)){
9 try {
10 db.getConnection();
11 db.executeUpdate(sql,null);
12 } catch(Exception ee) {
13 System.out.println(ee.toString());
14 } finally {
15 db.closeAll();
16 }
17 JOptionPane.showMessageDialog(null, "修改成功");
18 }
19 else{
20 JOptionPane.showMessageDialog(null, "两次密码不一样!");
21 }
22 }
23 }

修改考生信息效果如下:

重置考生密码部分代码如下:

 1 public class listener_of_delete implements ActionListener{
2 public void actionPerformed(ActionEvent e){
3 String id = jtId.getText();
4 DBUtil db = new DBUtil();
5 String sql = "update information_of_students set pwd = '000000' where id = '"+id+"'";
6 try {
7 db.getConnection();
8 db.executeUpdate(sql,null);
9 } catch(Exception ee) {
10 System.out.println(ee.toString());
11 } finally {
12 db.closeAll();
13 }
14 JOptionPane.showMessageDialog(null, "重置成功");
15 }
16 }

重置考生密码效果如下:


四、完整源码下载

学生会考成绩管理系统源码下载:

  • 关注我的原创微信公众号:『小鸿星空科技』,回复『学生会考成绩管理系统』获取完整项目


五、作者Info

作者:南柯树下,Goal:让编程更有趣!

原创微信公众号:『小鸿星空科技』,专注于算法、爬虫,网站,游戏开发,数据分析、自然语言处理,AI等,期待你的关注,让我们一起成长、一起Coding!

版权声明:本文禁止抄袭、转载 ,侵权必究!


欢迎扫码关注我的原创公众号【小鸿星空科技】,回复【学生会考成绩管理系统】获取完整项目


——  ——  ——  ——  —  END  ——  ——  ——  ——  ————

         欢迎扫码关注我的公众号

          小鸿星空科技

       

Java+Eclipse+MySQL+Swing实现学生会考成绩管理系统(免费完整项目)的更多相关文章

  1. Java eclipse下 Ant build.xml实例详解 附完整项目源码

    在有eclipse集成环境下ant其实不是很重要,但有些项目需要用到,另外通过eclipse来学习和理解ant是个很好的途径,所以写他demo总结下要点,希望能够帮到大家. 一.本人测试环境eclip ...

  2. java 数组 输入5名学生的成绩 得出平均分。

    import java.util.Scanner; public class LianXi4{ public static void main(String[] args){ //创建长度为5的数组 ...

  3. MySQL 创建一个简单的成绩管理系统

    操作过程使用实验楼. 首先是创建一个数据库studentsystem,使用语句是: CREATE DATABASE studentsystem;  查看创建好的数据库的命令还是SHOW DATABAS ...

  4. DAO JDBC 学生成绩管理系统

    1:student.course类 package JDBCU; public class Student { private String no; private String name; publ ...

  5. JDBC成绩管理系统

    import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sq ...

  6. 学生成绩管理系统 1.0(Java+MySql)

    真难…… 数据库建立不会,中文编码不会,插入数据不会,删除不会…… Java读入数据不会……数据库连接不会…… 你也好意思说自己是学计算机的啊魂淡…… 我会慢慢写2.0,3.0版的……噗…… src/ ...

  7. 学生成绩管理系统(SSM+MySQL+JSP)

    开发工具:Eclipse前端技术:基础:html+css+JavaScript框架:JQuery+H-ui后端技术:Spring+SpringMVC+mybatis模板引擎:JSP数据库:mysql ...

  8. Java课程设计——学生成绩管理系统(201521123003 董美凤)

    Java课程设计--学生成绩管理系统(201521123003 董美凤) 1.团队课程设计博客链接 学生成绩管理系统博客链接 2.个人负责模块或任务说明 信息修改 密码修改 部分界面设计 3.自己的代 ...

  9. JSP+Servlet+JDBC+mysql实现的学生成绩管理系统

    项目简介 项目来源于:https://gitee.com/zzdoreen/SSMS 本系统基于JSP+Servlet+Mysql 一个基于JSP+Servlet+Jdbc的学生成绩管理系统.涉及技术 ...

随机推荐

  1. java中的collection小结

    Collection 来源于Java.util包,是非常实用常用的数据结构!!!!!字面意思就是容器.具体的继承实现关系如下图,先整体有个印象,再依次介绍各个部分的方法,注意事项,以及应用场景.   ...

  2. [学习总结]8、android 自定义控件 使用declare-styleable进行配置属性(源码角度)

    declare-styleable:declare-styleable是给自定义控件添加自定义属性用的. 官方的相关内部控件的配置属性文档:http://developer.android.com/r ...

  3. 用户创建firefox配置文件

    1.打开cmd进放 firefox.exe所在的目录 如:D:\>cd D:\Mozilla Firefox 2.运行如命令:D:\Mozilla Firefox>firefox.exe ...

  4. 【C/C++】小红的字符串 / 中兴捧月

    考试的时候想复杂了,其实直接一边写放进set里去重就可以了 很有意思 自己的理解就是cpp的map+set或者就是set可以完成大多数java的hashset操作 链接:https://ac.nowc ...

  5. typescript接口---interface

    假如我现在需要批量生产一批对象,这些对象有相同的属性,并且对应属性值的数据类型一致.该怎么去做? 在ts中,因为要检验数据类型,所以必须对每个变量进行规范,自然也提供了一种批量规范的功能.这个功能就是 ...

  6. Jmeter——脱离Jenkins后,Ant集成邮件通知

    之前搭建在本地的Jenkins环境,由于重装系统的原因,环境不能用了.在用jmeter做测试的时候,索性用本地ant构建,运行下来也一样平稳. 结合Jenkins搭建环境,可以参考博文:Jenkins ...

  7. bjdctf_2020_babyrop2(没有成功拿到shell)

    看到程序先例行检查一下 可以看到开启了canary和nx保护,需要注意的是这个acnary 将程序放入ida中shift+f12 没有关键性函数.我们进入main函数中 在main的gift程序里面我 ...

  8. Hyper-v安装Centos7

    开篇语 知识库地址:https://azrng.gitee.io/kbms 介绍 可以让你在你的电脑上以虚拟机的形式运行多个操作系统(至于为什么选择这个,主要是系统已经自带了,所以能不装其他我就先不装 ...

  9. 手动上下eureka上面服务

    手动下eureka curl -X PUT http://eureka.xxx.xxx.com/eureka/apps/VIDEO-API/111.111.111.111:test-api:0000/ ...

  10. idea删除同一个模块后新建模块显示被占用

    当我们某个模块因为什么原因需要删除重建的时候 ,输入完模块名称并不能创建出来,这是因为模块已经被注册 解决办法: 1.右键点击项目名称---选择Load/Unload Modules 2.将已经删除的 ...