Java程序设计系专业班级学号15号姓名刘振基题目学生成绩管理系统任课教师彭杰一:要求1、用到书上(课本或实验册)上的至少三个实例2、用到至少两种布局和至少四种组件3、用到对话框4、用到对数据库的查询、删除、添加和修改5、最好用到输入输出流6、具有一定的实际意义二:内容本系统用access作为数据库,用到了书上的布局实例和数据库连接实例功能:1、输入十个同学的学号,姓名,出生日期,二科成绩(学,大学英语)。2、输入学号查询学生信息。3、删除记录4、查询记录5、添加记录6、修改记录三:代码第一部分:publicclassmain{publicstaticvoidmain(String[]args){zhuchuangkouwin=newzhuchuangkou();}}第二部分主界面:importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.*;publicclasszhuchuangkouextendsFrameimplementsActionListener{Buttonbutton1,button2,button3,button4,tuichu;Panelp1,p2,p3;Labell1,l2,l3;TextFielda1,a2;Boxb1,b2,b3,b4,b5;sss;zhuchuangkou(){button1=newButton(登陆);button2=newButton(删除);button3=newButton(修改);button4=newButton(添加);tuichu=newButton(退出);p1=newPanel();p2=newPanel();p3=newPanel();l1=newLabel(学生成绩管理,Label.CENTER);l1.setFont(newFont(宋体,Font.BOLD,72));l1.setBackground(Color.green);l2=newLabel(登录名);l3=newLabel(密码);a1=newTextField(10);a2=newTextField(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.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.addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);add(p3,BorderLayout.PAGE_END);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});setBackground(Color.RED);setBounds(10,10,1000,500);setVisible(true);validate();}publicvoidactionPerformed(ActionEvente){if(e.getSource()==tuichu){System.exit(0);}if(e.getSource()==button1){if(a1.getText().equals(liuzhenji)&&a2.getText().equals(123456)){newchuankou();System.out.println();dispose();}else{System.out.print(nishurucuowu);}}}}第三部分选择操作:importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.*;publicclasszhuchuangkouextendsFrameimplementsActionListener{Buttonbutton1,button2,button3,button4,tuichu;Panelp1,p2,p3;Labell1,l2,l3;TextFielda1,a2;Boxb1,b2,b3,b4,b5;sss;zhuchuangkou(){button1=newButton(登陆);button2=newButton(删除);button3=newButton(修改);button4=newButton(添加);tuichu=newButton(退出);p1=newPanel();p2=newPanel();p3=newPanel();l1=newLabel(学生成绩管理,Label.CENTER);l1.setFont(newFont(宋体,Font.BOLD,72));l1.setBackground(Color.green);l2=newLabel(登录名);l3=newLabel(密码);a1=newTextField(10);a2=newTextField(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.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.addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);add(p3,BorderLayout.PAGE_END);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});setBackground(Color.RED);setBounds(10,10,1000,500);setVisible(true);validate();}publicvoidactionPerformed(ActionEvente){if(e.getSource()==tuichu){System.exit(0);}if(e.getSource()==button1){if(a1.getText().equals(liuzhenji)&&a2.getText().equals(123456)){newchuankou();System.out.println();dispose();}else{System.out.print(nishurucuowu);}}}}第四部分查询界面实现:importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.JOptionPane;publicclassssextendsFrameimplementsTextListener,ActionListener{Buttonxunzhao;TextFieldinput;TextAreashow;Strings;intk;Connectioncon;Statementsql;intsum=0;ResultSetrs;ss(){Panelp=newPanel();xunzhao=newButton(查找);input=newTextField(10);show=newTextArea(6,43);p.add(newLabel(输入学号));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(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoidactionPerformed(ActionEventee){booleanboo=true;s=input.getText();k=Integer.parseInt(s);try{Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);}catch(ClassNotFoundExceptioneee){System.out.println(+eee);}try{con=DriverManager.getConnection(jdbc:odbc:sun,gxy,123);sql=con.createStatement();rs=sql.executeQuery(SELECT*FROMchengjibiao);while(rs.next()){intnumber=rs.getInt(number);Stringname=rs.getString(name);Stringdate=rs.getString(birthday);intmath