版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、面向对象课程设计java大作业报告含源代码面向对象课程设计java大作业报告含源代码13/13面向对象课程设计java大作业报告含源代码Java程序设计报告年级专业信息管理与信息系统学号学生姓名指导教师二一四年六月一、所用到的表的构造及数据种类customer顾客表表名customer顾客说明此表记录顾客基本信息列名说明数据种类拘束cno顾客编号char(10)主码cname顾客姓名char(10)cage年纪intcsex性别char(2)取值为男或女,默认女ctelephone顾客联系方式char(15)非空操作人员表表名操作人员说明此表记录操作人员信息列名说明数据种类拘束用户名用户登录名
2、nchar(10)主码密码登录密码nchar(3)非空职位担当职务nchar(10)二、程序的功能及实现结果截图1、登录功能翻开Java文件运转后输入错误的用户名后出现:输入用户名Lucy密码:123点击登录进入操作界面:2、增添功能下拉顾客信息系统菜单,选择增添客户信息增添信息前数据库客户表的内容:没有编号0000013增添客户0000013:数据库内表变成:注:0000015号是截图以前增添进去的3、查问功能下拉客户信息系统菜单,选择查问客户信息,输入客户编码0000013后点击确立查问此顾客:4、改正功能下拉菜单客户信息系统,选择改正客户信息,从头输入相应的正确信息,将错误的覆盖掉,此处
3、将0000013张蔷年纪改为32:数据库表内内容:5、删除功能下拉菜单客户信息系统,选择删除客户信息,输入客户编码数据库信息变成:0000013号信息已经删除0000013点击确认:6、退出系统功能下拉菜单客户信息管理选择退出:而后就退出了界面。三、程序源代码packageLoginSystem;import.*;import.*;import.*;import.*;quals(pwds)(null,用户名或密码错误!,错误,;elsenewGoods();dispose();(con);(state);(rs);catch(SQLExceptione)(null,用户名或密码错误!,错误,;
4、);publicstaticvoidcloseConn(Connectionconn)tryif(conn!=null)();catch(SQLExceptione)();publicstaticvoidcloseState(Statementstate)tryif(state!=null)();catch(SQLExceptione)();publicstaticvoidcloseRs(ResultSetrs)tryif(rs!=null)();catch(SQLExceptione)();连结数据库publicstaticConnectiongetConnection()Stringuse
5、rName=sa;StringuserPwd=123;Connectionconn=null;try(driverName);conn=(dbURL,userName,userPwd);catch(Exceptione)();returnconn;菜单界面classGoodsprivatestaticfinallongserialVersionUID=1L;staticfinalintWIDTH=760;staticfinalintHEIGHT=510;JPopupMenupop;JMenuItemitem2;JFramef;JMenuItemitem1;JPanelp;JTabbedPane
6、tp;publicGoods()f=newJFrame(梦之路时髦天堂商品管理系统);JMenuBarmenubar1=newJMenuBar();tp=newJTabbedPane();p=newJPanel();(menubar1);(p);(tp);JMenumenu1=newJMenu(顾客信息系统);(Z);(menu1);JMenuItemitem1=newJMenuItem(增添客户信息);JMenuItemitem2=newJMenuItem(改正客户信息);JMenuItemitem3=newJMenuItem(查问客户信息);JMenuItemitem4=newJMenuI
7、tem(删除客户信息);JMenuItemitem5=newJMenuItem(退出);(item1);(item2);(item3);(item4);(item5);(p);JLabellb=newJLabel(newImageIcon();(lb);(true);(WIDTH,HEIGHT);Toolkitkit=();DimensionscreenSize=();intwidth=;intheight=;intx=(width-WIDTH)/2;inty=(height-HEIGHT)/2;(x,y);(newActionListener()publicvoidactionPerform
8、ed(ActionEventEvent)Addcon1=newAdd();(增添客户信息,con1);(0,true);(0,增添客户信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEvent)Updatecon2=newUpdate();(改正客户信息,con2);(0,true);(0,改正客户信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEv
9、ent)Selectcon3=newSelect();(查问客户信息,con3);(0,true);(0,查问客户信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEventEvent)Delectcon4=newDelect();(删除客户信息,con4);(0,true);(0,删除客户信息);(newDimension(500,200););(newActionListener()publicvoidactionPerformed(ActionEvente)(0););(new
10、MenuListener()publicvoidmenuSelected(MenuEventevent)(!();publicvoidmenuDeselected(MenuEventevent)publicvoidmenuCanceled(MenuEventevent);/信息增添classAddextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Add()GridBagLayoutlay=newGridBag
11、Layout();setLayout(lay);JButtonok=newJButton(确立);JButtonclear=newJButton(清空);JButtonc=newJButton(封闭);JLabelname=newJLabel(姓名);JLabelphone=newJLabel(电话号码);JLabelsex=newJLabel(性别);JLabelnum=newJLabel(客户编码);JLabelyears=newJLabel(年纪);Fontfont=newFont(Serief,22);finalJTextFieldnameinput=newJTextField(10)
12、;finalJTextFieldphoneinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);JLabeltitle=newJLabel(顾客基本信息);(font);JButtonadditionbutton=newJButton(增添);GridBagConstraintsconstraints=newGridBagConstraints()
13、;=;=4;=7;add(title,constraints,0,0,4,1);add(num,constraints,0,4,1,1);add(name,constraints,0,1,1,1);add(phone,constraints,0,5,1,1);add(sex,constraints,0,3,1,1);add(years,constraints,0,2,1,1);add(nameinput,constraints,1,1,1,1);add(phoneinput,constraints,1,5,1,1);add(sexinput,constraints,1,3,1,1);add(n
14、uminput,constraints,1,4,1,1);add(yearsinput,constraints,1,2,1,1);add(ok,constraints,3,1,1,1);add(clear,constraints,3,3,1,1);add(c,constraints,3,5,1,1);(newActionListener()publicvoidactionPerformed(ActionEventEvent)removeAll(););(newActionListener()publicvoidactionPerformed(ActionEventEvent)trycatch(
15、ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;Stringnametext=();Stringphonetext=();Stringsextext=();Stringnumtext=();Stringyearstext=();tryConnectioncon=(url,user,password);prestmt=(INSERTINTOcustomer顾客VALUES(?,?,?,?,?);(5,phonetext);(2,
16、nametext);(4,sextext);(1,numtext);(3,yearstext);();();(null,信息增添成功,OK,;catch(SQLExceptionex);(newActionListener()publicvoidactionPerformed(ActionEventEvent)();();();();(););/信息改正classUpdateextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,const
17、raints);Update()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(确立);JButtonclear=newJButton(清空);JButtonc=newJButton(封闭);JLabelname=newJLabel(姓名);JLabelphone=newJLabel(电话号码);JLabelsex=newJLabel(性别);JLabelnum=newJLabel(客户编码);JLabelyears=newJLabel(年纪);finalJTextFieldnameinput=ne
18、wJTextField(10);finalJTextFieldphoneinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);JLabeltitle=newJLabel(改正基本信息);Fontfont=newFont(Serief,22);(font);/设置标签前风景JButtonadditionbutton=newJButton(增添);Gr
19、idBagConstraintsconstraints=newGridBagConstraints();=;=4;=7;add(title,constraints,0,0,4,1);add(name,constraints,0,1,1,1);add(phone,constraints,0,5,1,1);add(sex,constraints,0,3,1,1);add(num,constraints,0,4,1,1);add(nameinput,constraints,1,1,1,1);add(phoneinput,constraints,1,5,1,1);add(sexinput,constr
20、aints,1,3,1,1);add(numinput,constraints,1,4,1,1);add(years,constraints,0,2,1,1);add(yearsinput,constraints,1,2,1,1);add(ok,constraints,3,1,1,1);add(clear,constraints,3,3,1,1);add(c,constraints,3,5,1,1);(newActionListener()publicvoidactionPerformed(ActionEvente)removeAll(););(newActionListener()publi
21、cvoidactionPerformed(ActionEventEvent)trycatch(ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;Stringnametext=();Stringphonetext=();Stringsextext=();Stringnumtext=();Stringyearstext=();tryConnectionconn=(url,user,password);prestmt=(updatec
22、ustomer顾客setcname=?,csex=?,ctelephone=?,cage=?WHEREcno=?);(1,nametext);(2,sextext);(5,numtext);(4,yearstext);(3,phonetext);();();();(null,信息改正成功,OK,;catch(SQLExceptionex)(););(newActionListener()publicvoidactionPerformed(ActionEventEvent)();();();();(););信息删除classDelectextendsJPanelpublicvoidadd(Com
23、ponentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Delect()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(确立删除此顾客!);JButtonclear=newJButton(清空);JLabelc=newJLabel(客户编码);Fontfont=newFont(Serief,22);(font);/设置标签前风景finalJTextFieldd=newJTextF
24、ield(16);JLabeltitle=newJLabel(辨别信息);JButtonadditionbutton=newJButton(增添);GridBagConstraintsconstraints=newGridBagConstraints();=;=4;=6;add(c,constraints,0,1,1,1);add(d,constraints,1,1,1,1);add(ok,constraints,0,2,1,1);add(clear,constraints,1,2,1,1);(newActionListener()publicvoidactionPerformed(Actio
25、nEventEvent)trycatch(ClassNotFoundExceptionex)Stringuser=sa;Stringpassword=123;Statementstmt;ResultSetrs;PreparedStatementprestmt;tryConnectionconn=(url,user,password);prestmt=(DELETEFROMcustomer顾客WHEREcno=?);(1,();();();();(null,该顾客记录已删除,OK,;catch(SQLExceptionex);(newActionListener()publicvoidactio
26、nPerformed(ActionEventEvent)(););顾客信息查问classSelectextendsJPanelpublicvoidadd(Componentc,GridBagConstraintsconstraints,intx,inty,intw,inth)=x;=y;=w;=h;add(c,constraints);Select()GridBagLayoutlay=newGridBagLayout();setLayout(lay);JButtonok=newJButton(确立查问此顾客);JButtonclear=newJButton(清JLabelc=newJLabel
27、(客户编码);空);finalJTextFieldd=newJTextField(16);JLabeltitle=newJLabel(辨别信息);JButtonadditionbutton=newJButton(增添);JLabelname=newJLabel(姓名);JLabelid=newJLabel(客户编码);JLabelsex=newJLabel(性别);JLabelnum=newJLabel(电话号码);JLabelyears=newJLabel(年纪);finalJTextFieldnameinput=newJTextField(10);finalJTextFieldidinput=newJTextField(10);finalJTextFieldsexinput=newJTextField(10);finalJTextFieldnuminput=newJTextField(10);finalJTextFieldyearsinput=newJTextField(10);GridBagConstraintsconstraints=newGridBagConstrai
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 浙教版九年级科学下册教学设计:第1章 第2节 太阳系的形成和恒星的演化
- 新教材高中化学 专题2 研究物质的基本方法 1.2 物质的检验 物质性质和变化的探究(2)教学设计 苏教版必修1
- 三年级上科学教学设计-空气在哪里-青岛版(六年制三起)
- 植物脱毒苗的培育教学设计中职专业课-农业生物技术-农林类-农林牧渔大类
- 四年级信息技术下册 第1-16课教案(16) 辽师大版
- 任务二 合理使用零花钱教学设计小学劳动浙教版二年级下册-浙教版
- 四川省棠湖中学高中体育与健康武术教案:18 初级刀第四段
- 设施农业基本知识教学设计中职专业课-农业经营与管理-农林类-农林牧渔大类
- 2026光刻胶图案转移精度影响因素与工艺控制要点技术报告
- 交通安全主题班会教学设计
- 装修电话营销培训
- 2025年河北美术学院行政科员、辅导员招聘16人考试笔试参考题库附答案解析
- 2025年澳洲amc9年级竞赛题库及答案
- 2025-2026学年统编版语文二年级上册第一单元早读课件
- 钢丝绳安全使用培训课件
- 六堡茶课件教学课件
- 挡墙重点难点施工方案
- 电工电焊工安全培训课件
- 2025年贵州省初、中级专业技术资格考试(给排水)历年参考题库含答案详解(5卷)
- 2025年秋季小学六年级上册语文教学计划及教学进度表
- 测绘服务质量保障措施及方案
评论
0/150
提交评论