基于JAVA的学生成绩管理系统源代码1.doc

上传人:夺命阿水 文档编号:17672 上传时间:2022-07-01 格式:DOC 页数:17 大小:171KB
返回 下载 相关 举报
基于JAVA的学生成绩管理系统源代码1.doc_第1页
第1页 / 共17页
基于JAVA的学生成绩管理系统源代码1.doc_第2页
第2页 / 共17页
基于JAVA的学生成绩管理系统源代码1.doc_第3页
第3页 / 共17页
基于JAVA的学生成绩管理系统源代码1.doc_第4页
第4页 / 共17页
基于JAVA的学生成绩管理系统源代码1.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《基于JAVA的学生成绩管理系统源代码1.doc》由会员分享,可在线阅读,更多相关《基于JAVA的学生成绩管理系统源代码1.doc(17页珍藏版)》请在课桌文档上搜索。

1、 一:要求1、 用到书上课本或实验册上的至少三个实例2、 用到至少两种布局和至少四种组件3、 用到对话框4、 用到对数据库的查询、删除、添加和修改5、 最好用到输入输出流6、 具有一定的实际意义二:容 本系统用access作为数据库,用到了书上的布局实例和数据库连接实例功能: 1、输入十个同学的学号,出生日期,二科成绩(学,大学英语) 。2、输入学号查询学生信息。 3、删除记录4、查询记录5、添加记录6、修改记录三:代码第一局部:public class main public static void main(String args) zhuchuangkou win=new zhuchua

2、ngkou();第二局部主界面:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;public class zhuchuangkou extends Frame implements ActionListenerButton button1,button2,button3,button4,tuichu;Panel p1,p2,p3;Label l1,l2,l3;TextField a1,a2;Box b1,b2,b3,b4,b5;ss s;zhuchuangkou

3、()button1=new Button(登陆);button2=new Button(删除);button3=new Button(修改);button4=new Button(添加);tuichu=new Button(退出);p1=new Panel();p2=new Panel();p3=new Panel();l1=new Label(学生成绩管理,Label.CENTER);l1.setFont(new Font(宋体,Font.BOLD,72);l1.setBackground(Color.green);l2=new Label(登录名);l3=new Label(密码);a1=

4、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);b4=Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut

5、(10);b4.add(tuichu);b3=Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b5=Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);button4.addAc

6、tionListener(this);tuichu.addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);add(p3,BorderLayout.PAGE_END);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););setBackground(Color.RED);setBounds(10, 10, 1000, 500);

7、setVisible(true);validate();public void actionPerformed(ActionEvent e)if(e.getSource()=tuichu)System.exit(0);if(e.getSource()=button1)if(a1.getText().equals(liuzhenji)&a2.getText().equals(123456)new chuankou();System.out.println(wwwww);dispose();elseSystem.out.print(nishurucuowu);第三局部选择操作:import jav

8、a.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;public class zhuchuangkou extends Frame implements ActionListenerButton button1,button2,button3,button4,tuichu;Panel p1,p2,p3;Label l1,l2,l3;TextField a1,a2;Box b1,b2,b3,b4,b5;ss s;zhuchuangkou()button1=new Button(登陆);b

9、utton2=new Button(删除);button3=new Button(修改);button4=new Button(添加);tuichu=new Button(退出);p1=new Panel();p2=new Panel();p3=new Panel();l1=new Label(学生成绩管理,Label.CENTER);l1.setFont(new Font(宋体,Font.BOLD,72);l1.setBackground(Color.green);l2=new Label(登录名);l3=new Label(密码);a1=new TextField(10);a2=new T

10、extField(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);b4=Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut(10);b4.add(tuichu);b3=Box

11、.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b5=Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);button4.addActionListener(this);tuichu.

12、addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);add(p3,BorderLayout.PAGE_END);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););setBackground(Color.RED);setBounds(10, 10, 1000, 500);setVisible(true);validate(

13、);public void actionPerformed(ActionEvent e)if(e.getSource()=tuichu)System.exit(0);if(e.getSource()=button1)if(a1.getText().equals(liuzhenji)&a2.getText().equals(123456)new chuankou();System.out.println(wwwww);dispose();elseSystem.out.print(nishurucuowu);第四局部查询界面实现:import java.awt.*;import java.awt.

14、event.*;import java.sql.*;import javax.swing.JOptionPane;public class ss extends Frame implements TextListener,ActionListenerButton xunzhao;TextField input;TextArea show;String s;int k;Connection con; Statement sql; int sum=0; ResultSet rs;ss()Panel p=new Panel();xunzhao= new Button(查找);input= new T

15、extField(10);show= new TextArea(6,43);p.add(new Label(输入学号);p.add(input);p.add(xunzhao);xunzhao.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p,BorderLayout.NORTH);add(show,BorderLayout.CENTER);setBounds(10,30,500,200);setVisible(true);validate();addWindowListener(ne

16、w WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;s=input.getText();k=Integer.parseInt(s);try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch(ClassNotFoundException eee) System.out.println(+eee); try con=DriverManager

17、.getConnection(jdbc:odbc:sun,gxy,123); sql=con.createStatement(); rs=sql.executeQuery(SELECT * FROM chengjibiao ); while(rs.next() int number=rs.getInt(number); String name=rs.getString(name); String date=rs.getString(birthday); int math=rs.getInt(math); int english=rs.getInt(english); if(number=k)

18、boo=false; show.setText(null); show.append(学号:+number+ :+name+ 出生:+date+ 数学 +math+ 英语 +english); show.append(n); con.close(); if(boo) JOptionPane.showMessageDialog(this, 你输入的学号不存在); catch(SQLException eee) System.out.println(eee); 第五局部删除:import java.awt.*;import java.awt.event.*;import java.sql.*;im

19、port javax.swing.JOptionPane;public class shanchu extends Frame implements TextListener,ActionListenerButton xunzhao;TextField input;TextArea show;String s;int k,s1,j;Connection con; Statement sql; int sum=0; ResultSet rs;shanchu()Panel p=new Panel();xunzhao= new Button(删除);input= new TextField(10);

20、show= new TextArea(6,43);p.add(new Label(输入要删除的 +学号);p.add(input);p.add(xunzhao);xunzhao.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p,BorderLayout.NORTH);add(show,BorderLayout.CENTER);setBounds(10,30,500,200);setVisible(true);validate();addWindowListener(new Windo

21、wAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;s=input.getText();k=Integer.parseInt(s);String m,dir;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch(ClassNotFoundException eee) System.out.println(+eee); try con=DriverM

22、anager.getConnection(jdbc:odbc:sun,gxy,123); sql=con.createStatement(); rs=sql.executeQuery(SELECT * FROM chengjibiao); while(rs.next() int number=rs.getInt(2); String name=rs.getString(3); String date=rs.getString(birthday); int math=rs.getInt(math); int english=rs.getInt(english); if(number=k) sho

23、w.setText(你删除了:); show.append(学号:+number+ :+name+ 出生:+date+ 数学 +math+ 英语 +english); show.append(n); m=DELETE FROM chengjibiao WHERE number=+k+; sql.executeUpdate(m); con.close(); catch(SQLException e) System.out.println(e); 第六局部修改:import java.awt.*;import java.awt.event.*;import java.sql.*;import ja

24、vax.swing.JOptionPane;public class xiugai extends Frame implements TextListener,ActionListenerButton charu;TextField input1,input2,input3,input4,input5,input6;TextArea show;Panel p1,p2;int k,s1,j;Connection con; Statement sql; int sum=0; ResultSet rs;xiugai() p1=new Panel(); p2=new Panel();charu= ne

25、w Button(修改);input1= new TextField(10);input2= new TextField(10);input3= new TextField(10);input4= new TextField(10);input5= new TextField(10);input6= new TextField(10);show= new TextArea(6,43);p1.add(new Label(请输入要修改的学号);p1.add(new Label(number);p1.add(input1);p2.add(new Label(请输入修改的数据);p2.add(new

26、Label(name);p2.add(input2);p2.add(new Label(date);p2.add(input3);p2.add(new Label(math);p2.add(input4);p2.add(new Label(english);p2.add(input5);p2.add(charu);charu.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);setBou

27、nds(10,30,1200,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;String s0,s1,s2,s3,s4,s5,insert1,recode,name,date;int m0,m1,m2,m3,number,math,english;s1=input1.getTex

28、t();m1=Integer.parseInt(s1);number=m1;s4=input4.getText();m2=Integer.parseInt(s4);math=m2;s5=input5.getText();m3=Integer.parseInt(s5);english=m3;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch(ClassNotFoundException eee) System.out.println(+eee); try con=DriverManager.getConnection(jdbc:odbc:

29、sun,gxy,123); sql=con.createStatement();recode=(+m0+,+number+,+name+,+date+,+math+,+english+); insert1=UPDATE chengjibiao SET math=+math+,english=+english+ WHERE number=+number+; sql.executeUpdate(insert1); catch(SQLException e) System.out.println(e); 第七局部添加:import java.awt.*;import java.awt.event.*

30、;import java.sql.*;import javax.swing.JOptionPane;public class charu extends Frame implements TextListener,ActionListenerButton charu;TextField input1,input2,input3,input4,input5,input6;TextArea show;int k,s1,j;Connection con; Statement sql; int sum=0; ResultSet rs;charu()Panel p=new Panel();charu=

31、new Button(插入);input1= new TextField(10);input2= new TextField(10);input3= new TextField(10);input4= new TextField(10);input5= new TextField(10);input6= new TextField(10);show= new TextArea(6,43);p.add(new Label(请输入要插入的数据);p.add(new Label(ID);p.add(input6);p.add(new Label(number);p.add(input1);p.add

32、(new Label(name);p.add(input2);p.add(new Label(date);p.add(input3);p.add(new Label(math);p.add(input4);p.add(new Label(english);p.add(input5);p.add(charu);charu.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p,BorderLayout.NORTH);add(show,BorderLayout.CENTER);setBound

33、s(10,30,1200,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;String s0,s1,s2,s3,s4,s5,insert1,recode,name,date;int m0,m1,m2,m3,number,math,english;s0=input5.getText(

34、);m0=Integer.parseInt(s0);s1=input1.getText();m1=Integer.parseInt(s1);number=m1;s2=input2.getText();name=s2;s3=input3.getText();date=s3;s4=input4.getText();m2=Integer.parseInt(s4);math=m2;s5=input5.getText();m3=Integer.parseInt(s5);english=m3;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); catch(Cl

35、assNotFoundException eee) System.out.println(+eee); try con=DriverManager.getConnection(jdbc:odbc:sun,gxy,123); sql=con.createStatement();recode=(+m0+,+number+,+name+,+date+,+math+,+english+);insert1=INSERT INTO chengjibiao VALUES +recode;sql.executeUpdate(insert1); show.setText(你插入了:); show.append(

36、学号:+number+ :+name+ 出生:+date+ 数学 +math+ 英语 +english); show.append(n); catch(SQLException e) System.out.println(e); JOptionPane.showMessageDialog(this, 你输入的不正确); 四:运行效果五总结:本次课程设计,让我获益匪浅,不仅更深入的了解Java这门学科,更使自己有了继续探索的兴趣。于个人而言,在程序设计的过程中,我深感“认真严谨这个词的重要性,一点点小的马虎,便会导致整个程序不能正常运行。在今后的学习中,我定将“认真严谨时刻作为自的谨言。与此同时,本小组成员的互帮互助,让我体会到了团结的力量,而更让人难以忘怀的是在热烈讨论问题时,那激情横溢的场面。总之,此次课程设计在我的学生生涯中启上了至关重要的作用。最后,真诚的感教师的指导和教导。17 / 17

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 在线阅读 > 生活休闲


备案号:宁ICP备20000045号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000986号