




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、java程序设计系 别 专 业班 级学 号 15号姓 名 刘xx题 目基于java的学生成绩管理系统设计与实现任课教师 彭zz一:要求1、 用到书上(课本或实验册)上的至少三个实例2、 用到至少两种布局和至少四种组件3、 用到对话框4、 用到对数据库的查询、删除、添加和修改5、 最好用到输入输出流6、 具有一定的实际意义二:内容 本系统用access作为数据库,用到了书上的布局实例和数据库连接实例功能: 1、输入十个同学的学号,姓名,出生日期,二科成绩(学,大学英语) 。2、输入学号查询学生信息。 3、删除记录4、查询记录5、添加记录6、修改记录三:代码第一部分:public class ma
2、in public static void main(string args) zhuchuangkou win=new zhuchuangkou();第二部分主界面: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
3、;label l1,l2,l3;textfield a1,a2;box b1,b2,b3,b4,b5;ss s;zhuchuangkou()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);
4、l1.setbackground(color.green);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);b4=box.cr
5、eatehorizontalbox();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.a
6、ddactionlistener(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(new windowadapter()public void windowclosing(windowevent
7、e)dispose(););setbackground(color.red);setbounds(10, 10, 1000, 500);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(www
8、ww);dispose();elsesystem.out.print(nishurucuowu);第三部分选择操作: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
9、a1,a2;box b1,b2,b3,b4,b5;ss s;zhuchuangkou()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.gre
10、en);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);b4=box.createhorizontalbox();b4.add
11、(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);but
12、ton3.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(new windowadapter()public void windowclosing(windowevent e)dispose(););setbackgroun
13、d(color.red);setbounds(10, 10, 1000, 500);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.o
14、ut.print(nishurucuowu);第四部分查询界面实现:import java.awt.*;import java.awt.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; resul
15、tset rs;ss()panel p=new panel();xunzhao= new button(查找);input= new textfield(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);setbo
16、unds(10,30,500,200);setvisible(true);validate();addwindowlistener(new 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(classno
17、tfoundexception eee) system.out.println(+eee); try con=drivermanager.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
18、 math=rs.getint(math); int english=rs.getint(english); if(number=k) 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);
19、 第五部分删除:import java.awt.*;import java.awt.event.*;import java.sql.*;import 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(
20、)panel p=new panel();xunzhao= new button(删除);input= new textfield(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(
21、10,30,500,200);setvisible(true);validate();addwindowlistener(new windowadapter()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
22、(classnotfoundexception eee) system.out.println(+eee); try con=drivermanager.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
23、math=rs.getint(math); int english=rs.getint(english); if(number=k) show.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); 第六部分
24、修改:import java.awt.*;import java.awt.event.*;import java.sql.*;import javax.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; i
25、nt sum=0; resultset rs;xiugai() p1=new panel(); p2=new panel();charu= 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);p1.add(new label(请输入要修改的学号);p1.add
26、(new label(number);p1.add(input1);p2.add(new label(请输入修改的数据);p2.add(new 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.setedita
27、ble(false);add(p1,borderlayout.north);add(p2,borderlayout.center);setbounds(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,inser
28、t1,recode,name,date;int m0,m1,m2,m3,number,math,english;s1=input1.gettext();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)
29、system.out.println(+eee); try con=drivermanager.getconnection(jdbc:odbc: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)
30、 system.out.println(e); 第七部分添加:import java.awt.*;import java.awt.event.*;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; s
31、tatement sql; int sum=0; resultset rs;charu()panel p=new panel();charu= 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
32、(new label(id);p.add(input6);p.add(new label(number);p.add(input1);p.add(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
33、(false);add(p,borderlayout.north);add(show,borderlayout.center);setbounds(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
34、,recode,name,date;int m0,m1,m2,m3,number,math,english;s0=input5.gettext();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(
35、s5);english=m3;try class.forname(sun.jdbc.odbc.jdbcodbcdriver); catch(classnotfoundexception 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 val
36、ues +recode; sql.executeupdate(insert1); show.settext(你插入了:); show.append(学号:+number+ 姓名:+name+ 出生:+date+ 数学 +math+ 英语 +english); show.append(n); catch(sqlexception e) system.out.println(e); joptionpane.showmessagedialog(this, 你输入的不正确); 四:运行效果五总结:本次课程设计,让我获益匪浅,不仅更深入的了解java这门学科,更使自己有了继续探索的兴趣。于个人而言,在程
37、序设计的过程中,我深感“认真严谨”这个词的重要性,一点点小的马虎,便会导致整个程序不能正常运行。在今后的学习中,我定将“认真严谨时刻作为自的谨言。与此同时,本小组成员的互帮互助,让我体会到了团结的力量,而更让人难以忘怀的是在热烈讨论问题时,那激情横溢的场面。总之,此次课程设计在我的学生生涯中启上了至关重要的作用。最后,真诚的感谢彭老师的指导和教诲。気持今flying get!dou都斗豆逗陡抖痘兜读蚪窦篼蔸乧侸兠凟剅吺唗投斣枓梪橷毭氀浢渎渎瞗窬窦脰艔豆读逾郖酘酡钭鋀钭閗闘阧餖饾斗鬦鬪鬬鬭du读度毒渡堵独肚镀赌睹杜督都犊妒顿蠹笃嘟渎椟牍黩髑芏儥凟剢剫匵厾噣土涂妬嬻剬塅媏彖断毈瑖碫篅簖缎专腶葮褍踹
38、躖锻鍴mr najib met search crews at pearce raaf base near perth on thursday morning, before their planes left for the day, and then later held talks with mr abbott.the disappearance of mh370 has tested our collective resolve, he told a news conference.faced with so little evidence, and such a herculean
39、task, investigators from malaysia, the us, the uk, china, australia and france have worked without pausehe thanked both search teams and the australian government for their efforts in recent weeks, and said the search would go on.continue reading the main storymh370 - facts at a glance 8 march:malay
40、sia airlines kuala lumpur-beijing flight carrying 239 people disappears planes transponder, which communicates with ground radar, was switched off as it left malaysian airspace satellite pings indicate plane was still flying seven hours after satellite contact was lost 24 march:based on new calculat
41、ions, malaysian pm says beyond reasonable doubt that plane crashed in southern indian ocean with no survivors what we know the search for flight mh370i know that until we find the plane, many families cannot start to grieve. i cannot imagine what they must be going through. but i can promise them th
42、at we will not give up, he said.malaysian authorities have come in for heavy criticism over their management of the search, especially from relatives of thweather conditions were fair, with visibility of approximately 10km (6 miles), the joint agency coordination centre (jacc) - which is overseeing
43、the search - said.the british submarine hms tireless is also in the southern indian ocean and is due to be joined by royal navy ship hms echo.the australian navy ship ocean shield is heading to the region and has equipment for detecting the planes black-box flight recorder.experts say timing is crit
44、ical as the flight recorder may only have enough battery power to send out a signal until 7 april.air chief marshall angus houston, head of the jacc, warned that the search operation faced multiple difficulties.this is one of the most demanding and challenging search and rescue operations, or search
45、 and recovery operations, that i have ever seen and i think probably one of the most complex operations of this nature that the world has ever seen, he told mr najib and mr abbott.on wednesday malaysian police chief khalid abu bakar said investigators had cleared all passengers of possible involveme
46、nt in hijacking, sabotage or having personal or psychological problems that could have been connected to the disappearance.but he said that the criminal investigation could go on and on and on. we have to clear every little thing.at the end of the investigations, we may not even know the real cause. we may not even know the reason for this incident, he added.the police chief said that more than 170 interviews had been conducted with family members of the pilots and crew members, and that even cargo and food served on the plane were being investigated in case ofdui对队堆兑敦镦碓怼憝兊兑垖埻塠夺夺対对嵟憞怼
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年辅警招聘考试题及参考答案大全
- 2025年辅警招聘考试试题库含完整答案【必刷】
- 安师院世界地理教案10大洋洲
- 2025年上海戏曲艺术中心招聘工作人员的(1人)考前自测高频考点模拟试题含答案详解
- 2025中国国际工程咨询有限公司高端人才招聘1人考前自测高频考点模拟试题含答案详解
- 2025湖北武汉江夏区第一人民医院(协和江南医院)招聘35人考前自测高频考点模拟试题及完整答案详解1套
- 2025江苏徐州邳州市面向毕业生招聘编制教师208人考前自测高频考点模拟试题及答案详解1套
- 2025年贵港市就业服务中心招募高校毕业生就业见习人员(3人)笔试备考试题附答案详解(突破训练)
- 2025贵州中医药大学第一附属医院高层次人才引才13人考前自测高频考点模拟试题及参考答案详解
- 2025入团积极分子考试题库附参考答案详解【能力提升】
- 医院感染暴发报告流程与处置预案-课件
- 金蝶KIS专业版完整操作手册
- 公文写作与处理(培训课件)
- 艾滋病实验室质量管理与控制
- 档案销毁清册(封面)
- 施工方案安全交底
- 2024年中国汽车基础软件发展白皮书5.0-AUTOSEMO
- DB65-T 4773-2024 生物安全实验室消毒技术指南
- 肠梗阻课件完整版本
- 高压氧舱项目创业计划书
- 汕头广东汕头海关技术中心招聘(20240530)笔试历年典型考题及考点附答案解析
评论
0/150
提交评论