




免费预览已结束,剩余29页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
中南民族大学管理学院学生课程设计报告课程名称: Java语言课程设计 题 目: 学生成绩管理系统 年 级: 2010 专 业:信息管理与信息系统学号: 。姓名:SP_LJH 指导教师:张 晴 完成地点:管理学院综合实验室完成日期: 20 12 学年至20 13 学年度第 1 学期目录1题目描述和分析.12问题分解.13类(数据、方法)的设计.24编码35测试36操作使用说明67难点及关键技术分析68心得体会69.附录710指导老师批阅311题目描述和分析 一个图形用户界面,有两种权限登录方式,分别是老师和学生。老师登录系统能够查看学生的成绩以及一些基本的学生信息。如:学号,姓名,各科成绩。老师还能够在该系统里修改学生的成绩,登记学生的成绩。能按学号删除学生的记录,成绩等。学生登录该系统只能够查看自己的成绩,不能修改自己的成绩。该系统的登录都需要账号密码才能够修改和查看。在登录以前先选择好是老师登录还是学生登录,然后进入不同的页面行使不同的权限。该系统需要与数据库连接才能够完成上述的功能。2问题分解3类的设计本程序由于要用到图形用户界面所以用到了包有java.awt.*, java.awt.event.*, javax.swing.* 。 还连接了Microsoft SQL Server 所以还用到的包有连接数据库的包有 java.sql.Connection, java.sql.DriverManager,java.sql.ResultSet, java.sql.SQLException, java.sql.Statement。 类及其作用如下表:SQL Server2008里有三张表: 4编码见附录1.5测试和发布 运行程序之后选择登录窗口:选择老师登录与学生登录之后的页面: 老师登录之后的选择操作页面 学生登录之后的选择操作页面 添加操作 删除操作 修改操作 查询操作6操作使用说明 首先运行程序进入主界面:主界面选择登录身份老师,学生。当选择老师登录输入在数据库中表teacher里的帐号密码之后进入老师的操作界面,在这个界面老师可以选择的操作有添加,删除,修改,查询等操作。这些操作只要输入正确的学生学号及在数据库chengjibiao里的学号,就能进行相应的操作。当选择学生登录输入在数据库表student里的帐号密码之后进入学生的操作界面,在这个界面的学生只能进行查选操作,输入在数据库表chengjibiao里的正确学号就能查询相应的学号对应的信息。7难点及关键技术分析程序的难点是与数据库的连接上有点繁琐,在经过我在网上看到的很多资料之后把数据库与程序成功的连接了。程序存在的不足是程序的界面还不美观,看着不漂亮。8心得体会 通过这次课程设计我学会了使用Eclipse,还有Eclipse与Microsoft SQL Server 2008的连接。通过这次JAVA课程设计自己感觉自己的编程技巧有了一定的提高。9附录:程序代码包import java.awt.*;import java.awt.event.*;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.*;主类public class Chengjiguanli public static void main(String args) new xuanzedenglu();选择身份登录的窗口class xuanzedenglu extends JFrame implements ActionListener JFrame frame = new JFrame(选择登录窗口);JPanel imagePanel;ImageIcon bg;Button button1, button2;Box box;Label label;Panel p1;xuanzedenglu() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);p1 = new Panel();label = new Label(成绩管理系统, Label.CENTER);label.setFont(new Font(隶书, Font.BOLD, 30);label.setBackground(Color.green);p1.add(label);button1 = new Button(老师);button2 = new Button(学生);box = Box.createHorizontalBox();box.add(button1);box.add(Box.createHorizontalStrut(8);box.add(button2);button1.addActionListener(this);button2.addActionListener(this);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(););bg = new ImageIcon(2.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(box, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/设置关闭后状态frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(200, 200, 500, 300);frame.setResizable(false);/设置窗口大小不可改变frame.setVisible(true);validate();public void actionPerformed(ActionEvent e) if (e.getSource() = button1) new laoshidenglu();if (e.getSource() = button2) new xueshengdenglu();老师登录窗口class laoshidenglu extends JFrame implements ActionListener JFrame frame = new JFrame(登陆界面);JPanel imagePanel;ImageIcon bg;Button button1, button2;Label l1, l2, l3;TextField a1, a2;Box b1, b2, b3, b4, b5; Connection con;Statement sql;ResultSet rs;laoshidenglu() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);button1 = new Button(登陆);button2 = new Button(退出);Panel p1 = new Panel();l1 = new Label(学生成绩管理系统, Label.CENTER);l1.setFont(new Font(隶书, Font.BOLD, 40);l1.setBackground(Color.green);p1.add(l1);l2 = new Label(登录名);l3 = new Label(密码);a1 = new TextField(10);a2 = new TextField(10);a2.setEchoChar(*);b1 = Box.createVerticalBox();b1.add(l2);b1.add(Box.createVerticalStrut(8);b1.add(l3);b2 = Box.createVerticalBox();b2.add(a1);b2.add(Box.createVerticalStrut(8);b2.add(a2);b3 = Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b4 = Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut(10);b4.add(button2);b5 = Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(););bg = new ImageIcon(1.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(b5, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(200, 150, 510, 340);frame.setResizable(false);/设置窗口大小不可改变frame.setVisible(true);validate();public void actionPerformed(ActionEvent e) boolean boo = true;if (e.getSource() = button2) System.exit(0);if (e.getSource() = button1) try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch (ClassNotFoundException eee) System.out.println( + eee);try con = DriverManager.getConnection(jdbc:sqlserver:/localhost:1433;DatabaseName=学生成绩管理系统, sa, 55151777);sql = con.createStatement();rs = sql.executeQuery(SELECT * FROM teacher );while (rs.next() String username = rs.getString(username);String password = rs.getString(password);if (a1.getText().equals(username.trim()&a2.getText().equals(password.trim() boo = false;new laoshichuangkou(); frame.dispose();else JOptionPane.showMessageDialog(this, 账户密码错误,请重新输入!);con.close(); catch (SQLException eee) System.out.println(eee);老师选择操作窗口class laoshichuangkou extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JFrame frame = new JFrame(选择窗口);JPanel imagePanel;ImageIcon bg;Button button1, button2, button3, button4, button5, button6;Box box;Label label;Panel p1;laoshichuangkou() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);p1 = new Panel();label = new Label(欢迎使用成绩管理系统, Label.CENTER);label.setFont(new Font(隶书, Font.BOLD, 30);label.setBackground(Color.green);p1.add(label);button1 = new Button(添加);button2 = new Button(删除);button3 = new Button(修改);button4 = new Button(查询);button5 = new Button(返回);button6 = new Button(退出);box = Box.createHorizontalBox();box.add(button1);box.add(Box.createHorizontalStrut(8);box.add(button2);box.add(Box.createHorizontalStrut(8);box.add(button3);box.add(Box.createHorizontalStrut(8);box.add(button4);box.add(Box.createHorizontalStrut(8);box.add(button5);box.add(Box.createHorizontalStrut(8);box.add(button6);button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);button4.addActionListener(this);button5.addActionListener(this);button6.addActionListener(this);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(););bg = new ImageIcon(2.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(box, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/设置关闭后状态frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(200, 200, 500, 300);frame.setResizable(false);/设置窗口大小不可改变frame.setVisible(true);validate();public void actionPerformed(ActionEvent e) if (e.getSource() = button6) System.exit(0);if (e.getSource() = button1) new charu();if (e.getSource() = button2) new shanchu();if (e.getSource() = button3) new xiugai();if (e.getSource() = button4) new chaxun();if (e.getSource() = button5) new xuanzedenglu();frame.dispose(); else 学生登录窗口class xueshengdenglu extends JFrame implements ActionListener JFrame frame = new JFrame(学生登陆界面);JPanel imagePanel;ImageIcon bg;Button button1, button2;Label l1, l2, l3;TextField a1, a2;Box b1, b2, b3, b4, b5;Connection con;Statement sql;ResultSet rs;xueshengdenglu() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);button1 = new Button(登陆);button2 = new Button(退出);Panel p1 = new Panel();l1 = new Label(学生成绩管理系统, Label.CENTER);l1.setFont(new Font(隶书, Font.BOLD, 40);l1.setBackground(Color.green);p1.add(l1);l2 = new Label(登录名);l3 = new Label(密码);a1 = new TextField(10);a2 = new TextField(10);a2.setEchoChar(*);b1 = Box.createVerticalBox();b1.add(l2);b1.add(Box.createVerticalStrut(8);b1.add(l3);b2 = Box.createVerticalBox();b2.add(a1);b2.add(Box.createVerticalStrut(8);b2.add(a2);b3 = Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b4 = Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut(10);b4.add(button2);b5 = Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(););bg = new ImageIcon(1.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(b5, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(200, 150, 510, 340);frame.setResizable(false);/设置窗口大小不可改变frame.setVisible(true);validate();public void actionPerformed(ActionEvent e) boolean boo = true;if (e.getSource() = button2) System.exit(0);if (e.getSource() = button1) try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch (ClassNotFoundException eee) System.out.println( + eee);try con = DriverManager.getConnection(jdbc:sqlserver:/localhost:1433;DatabaseName=学生成绩管理系统, sa, 55151777);sql = con.createStatement();rs = sql.executeQuery(SELECT * FROM student );while (rs.next() String username = rs.getString(username);String password = rs.getString(password);if(a1.getText().equals(username.trim()&a2.getText().equals(password.trim() /if。 else 。 有问题!boo = false;new chuangkou();frame.dispose();/System.out.println(aa);elseJOptionPane.showMessageDialog(this, 账户密码错误,请重新输入!);/System.out.println(bb);con.close(); catch (SQLException eee) System.out.println(eee);学生选择操作窗口class chuangkou extends JFrame implements ActionListener JFrame frame = new JFrame(选择窗口);JPanel imagePanel;ImageIcon bg;Button button4, button5, button6;Box box;Label label;Panel p1;chuangkou() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);p1 = new Panel();label = new Label(欢迎使用成绩管理系统, Label.CENTER);label.setFont(new Font(隶书, Font.BOLD, 30);label.setBackground(Color.green);p1.add(label);button4 = new Button(查询);button5 = new Button(返回);button6 = new Button(退出);box = Box.createHorizontalBox();box.add(Box.createHorizontalStrut(8);box.add(button4);box.add(Box.createHorizontalStrut(8);box.add(button5);box.add(Box.createHorizontalStrut(8);box.add(button6);button4.addActionListener(this);button5.addActionListener(this);button6.addActionListener(this);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(););bg = new ImageIcon(2.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();imagePanel.add(p1, BorderLayout.NORTH);imagePanel.add(box, BorderLayout.CENTER);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/设置关闭后状态frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(200, 200, 500, 300);frame.setResizable(false);/设置窗口大小不可改变frame.setVisible(true);validate();public void actionPerformed(ActionEvent e) if (e.getSource() = button6) System.exit(0);if (e.getSource() = button4) new chaxun();if (e.getSource() = button5) new xuanzedenglu();frame.dispose(); else 添加,删除,修改,查询操作/* * 添加数据界面 */class charu extends JFrame implements ActionListener JFrame frame = new JFrame(添加数据);JPanel imagePanel;ImageIcon bg;Button sure;TextField input1, input2, input3, input4, input5;TextArea show;Box box1, box2, box3, box4;int k, s1, j;Connection con;Statement sql;ResultSet rs;charu() Toolkit kit = Toolkit.getDefaultToolkit();Image img = kit.getImage(tubiao.jpg);frame.setIconImage(img);input1 = new TextField(10);input2 = new TextField(10);input3 = new TextField(10);input4 = new TextField(10);input5 = new TextField(10);box2 = Box.createVerticalBox();box2.add(input1);box2.add(Box.createVerticalStrut(8);box2.add(input2);box2.add(Box.createVerticalStrut(8);box2.add(input3);box2.add(Box.createVerticalStrut(8);box2.add(input4);box2.add(Box.createVerticalStrut(8);box2.add(input5);box1 = Box.createVerticalBox();box1.add(new Label(学号:);box1.add(Box.createVerticalStrut(8);box1.add(new Label(姓名:);box1.add(Box.createVerticalStrut(8);box1.add(new Label(生日:);box1.add(Box.createVerticalStrut(8);box1.add(new Label(数学:);box1.add(Box.createVerticalStrut(8);box1.add(new Label(英语:);box3 = Box.createHorizontalBox();box3.add(box1);box3.add(Box.createHorizontalStrut(1);box3.add(box2);show = new TextArea(6, 43);sure = new Button(确定);box4 = Box.createHorizontalBox();Label label1 = new Label(请输入数据);label1.setFont(new Font(宋体, Font.BOLD, 20);label1.setForeground(Color.blue);box4.add(label1);box4.add(Box.createHorizontalStrut(1);box4.add(sure);sure.addActionListener(this);bg = new ImageIcon(3.jpg);JLabel label = new JLabel(bg);label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight();imagePanel = (JPanel) frame.getContentPane();imagePanel.setOpaque(false);imagePanel.setLayout(new FlowLayout();show.setEditable(false);imagePanel.add(box4, BorderLayout.NORTH);imagePanel.add(box3, BorderLayout.CENTER);imagePanel.add(show, BorderLayout.SOUTH);frame.getLayeredPane().setLayout(null);frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE);/frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(bg.getIconWidth(), bg.getIconHeight();frame.setBounds(700, 200, 540, 440);frame.setResizable(false);frame.setVisible(true);validate();addWindowListener(new WindowAdapter() p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 子宫附件MR扫描课件
- 年度信息安全培训总结课件
- 年底餐饮人员安全培训课件
- 娱乐直播运营基础知识
- 年后安全教育培训
- 工业机器人ABB课件
- 威化品安全培训课件
- 家庭保洁服务协议书7篇
- 委托培训期间学员安全课件
- 平面和平面垂直课件
- 2025至2030年中国雪崩光电二极管行业市场现状调查及前景战略研判报告
- 2025年湖北省中考语文试卷真题(含标准答案)
- 2025年国有企业土地使用权出让合同标准文本
- 语文●全国甲卷丨2021年普通高等学校招生全国统一考试语文试卷及答案
- 三瘫一截康复
- JG/T 286-2010低温辐射电热膜
- 海南区污水处理项目可行性研究报告
- 应届生校招:管理培训生笔试试题及答案
- 机械维修工试题及答案
- AI+汽车智能化系列之十一:以地平线为例探究第三方智驾供应商核心竞争力
- 年产30万立方米商砼建设项目环评资料环境影响
评论
0/150
提交评论