版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
-.z.综合实验蓝宇快递打印系统文档:鹏高目录一综合实验问题的需求分析1.1实验容和实验目的1.2问题描述1.3设计要求和功能描述二总体设计2.1系统目标2.2构建开发环境2.3系统功能结构三数据库设计3.1数据库概要说明3.2数据库E-R图3.3数据库结构四公共类设计4.1公共类DAO4.2公共类SaveUserStateTool五程序主要系统开发六调试与测试实验结果七实验总结参考文献附录(源代码)一综合实验问题的需求分析1.1实验容和实验目的(1)开发一个快递打印系统,以支持表单容的记录与打印。(2)通过本次综合实验,更进一步的了解和掌握Java语言。1.2问题描述随着社会的发展,人们的生活节奏不断加快。为了节约宝贵的时间,快递业务应运而生。在快递过程中,需要填写大量的表单。如果使用计算机来辅助填写及保存相应的记录,则能大大提高快递的效率。因此,需要开发一个快递打印系统。该系统应该支持快速录入关键信息,例如发件人和收件人的、和地址等,快递物品的信息等。并将其保存在数据库中以便以后查看。1.3设计要求和功能描述通过以上对快递系统的了解,要求其具备如下功能:(1)具有安全可靠的登陆系统。(2)能够添加快递单信息。(3)可以修改快递单信息。(4)可以打印快递单信息。(5)进入系统后,可以通过“添加用户”功能添加新的用户信息。(6)能修改密码,提高系统的安全性。二总体设计2.1系统目标通过对系统进行深入的分析得知,本系统需要实现以下目标:(1)操作简单方便,界面整洁大方。(2)保证系统的安全性。(3)方便添加和修改快递信息。(4)完成快递单的打印功能。(5)支持用户添加和密码修改操作。2.2构建开发环境操作系统:Windows7旗舰版JDK版本:jdk-7u3-windows-i586IDE版本:IndigoServiceRelease2开发语言:Java后台数据库:SQLServer2005分辨率:最佳效果1024×768像素2.3系统功能结构在需求分析的基础上,确定了该系统需要实现的功能。根据功能设计出该系统的功能结构图,如下图所示。三数据库设计3.1数据库概要说明本系统采用SQLServer2005作为后台数据库。根据需求分析和功能结构图,为整个系统设计了两个数据表,分别用于存储快递单信息和用户信息。根据这两个表的存储信息和功能,分别设计对应的E-R图和数据表。3.2数据库E-R图快递单信息表tb_receiveSendMessage的E-R图,如左图所示。用户信息表tb_user的E-R图,如右图所示。3.3数据库结构四公共类设计公共类DAO,用于加载数据库驱动及建立数据库连接。具体设计如下:package.zzk.dao;importjava.sql.Connection;importjava.sql.DriverManager;importjava*.swing.JOptionPane;publicclassDAO{privatestaticDAOdao=newDAO();//声明DAO类的静态实例/***构造方法,加载数据库驱动*/publicDAO(){try{Class.forName("net.sourceforge.jtds.jdbc.Driver");//加载数据库驱动}catch(ClassNotFoundE*ceptione){JOptionPane.showMessageDialog(null,"数据库驱动加载失败,请将JTDS驱动配置到构建路径中。\n"+e.getMessage());}}/***获得数据库连接的方法**returnConnection*/publicstaticConnectiongetConn(){try{Connectionconn=null;//定义数据库连接Stringurl="jdbc:jtds:sqlserver://localhost:1433/db_E*pressPrint";//数据库db_E*press的URLStringusername="sa";//数据库的用户名Stringpassword="";//数据库密码conn=DriverManager.getConnection(url,username,password);//建立连接returnconn;//返回连接}catch(E*ceptione){JOptionPane.showMessageDialog(null,"数据库连接失败。\n请检查数据库用户名和密码是否正确。"+e.getMessage());returnnull;}}}公共类SaveUserStateTool,用于保存登录用户的用户名和密码。该类主要用于修改用户的密码。具体实现如下:package.zzk.tool;publicclassSaveUserStateTool{privatestaticStringusername=null;privatestaticStringpassword=null;publicstaticvoidsetUsername(Stringusername){SaveUserStateTool.username=username;}publicstaticStringgetUsername(){returnusername;}publicstaticvoidsetPassword(Stringpassword){SaveUserStateTool.password=password;}publicstaticStringgetPassword(){returnpassword;}}五程序主要系统开发1.系统登录系统设计(1)用于封装用户输入的登录信息的User设计:(2)用于封装用户名和密码进行验证的UserDao类设计:2.系统主界面系统设计3.添加快递信息系统设计4.修改快递信息系统设计5.打印快递单与打印设置系统设计6.添加用户窗体系统设计7.修改用户密码窗体系统设计六调试与测试实验结果(附注:用户使用说明及实验结果如下:)(1)程序说明本程序使用SQLServer2005数据库开发,导入项目以后需要再对数据库进行配置,配置完数据库运行项目启动文件src//zzk/frame/LoginFrame.java就可以运行程序了。(2)操作流程(1)启动程序以后,显示蓝宇快递打印系统登录界面,如图1所示:图1登录界面(2)输入用户、与密码之后,进入主界面,如图2所示,系统默认用户名mr,密码mrsoft。(3)进入主界面可以对快递单进行各种操作,如图3所示:七实验总结通过本次综合实验,我进一步了解和掌握了Java中类的概念和定义,继承和接口的概念和语法。通过实验,我也进一步了解和掌握了Java中GUI的实现和用法以及数据库等基本操作。当然,在实验的过程中,也遇到了很多问题,但在老师和同学的帮助和指导下终于解决了。对于本次的打印系统综合实验,不仅使我认识到了自己在Java语言学习中的不足,而且增进了我对Java语言学习和编程的兴趣和能力。也为后续Java的学习打下了一个良好的基础。参考文献:《Java应用开发与实践》--乃琦畅主编。《Java从初学到精通》--辛立伟帆编著附录(源代码如下:)package快递打印系统;importjava.awt.*;importjava*.swing.*;importjava*.swing.SwingUtilities;importjava*.swing.WindowConstants;importjava*.swing.ImageIcon;import;import;importjava.awt.print.PageFormat;importjava.awt.print.Printable;importjava.awt.print.PrinterJob;importjava.util.Vector;import;importjava.util.Arrays;importjava.sql.*;importjava.sql.SQLE*ception;importjava*.swing.JOptionPane;importjava.sql.DriverManager;//////////////////////////////////////classUser{privateStringname=null;privateStringpwd=null;privateStringokPwd=null;publicStringgetName(){returnname;}publicvoidsetName(Stringname){=name;}publicStringgetPwd(){returnpwd;}publicvoidsetPwd(Stringpwd){this.pwd=pwd;}publicvoidsetOkPwd(StringokPwd){this.okPwd=okPwd;}publicStringgetOkPwd(){returnokPwd;}}classE*pressMessage{privateintid=0;privateStringsendName=null;privateStringsendTelephone=null;privateStringsendpary=null;privateStringsendAddress=null;privateStringsendPostcode=null;privateStringreceiveName=null;privateStringreceiveTelephone=null;privateStringreceivepary=null;privateStringreceiveAddress=null;privateStringreceivePostcode=null;privateStringControlPosition=null;//快递单上添加信息的组件位置(坐标)privateStringe*pressSize=null;//快递单的尺寸(大小)publicintgetId(){returnid;}publicvoidsetId(intid){this.id=id;}publicStringgetSendName(){returnsendName;}publicvoidsetSendName(StringsendName){this.sendName=sendName;}publicStringgetSendTelephone(){returnsendTelephone;}publicvoidsetSendTelephone(StringsendTelephone){this.sendTelephone=sendTelephone;}publicStringgetSendpary(){returnsendpary;}publicvoidsetSendpary(Stringsendpary){this.sendpary=sendpary;}publicStringgetSendAddress(){returnsendAddress;}publicvoidsetSendAddress(StringsendAddress){this.sendAddress=sendAddress;}publicStringgetSendPostcode(){returnsendPostcode;}publicvoidsetSendPostcode(StringsendPostcode){this.sendPostcode=sendPostcode;}publicStringgetReceiveName(){returnreceiveName;}publicvoidsetReceiveName(StringreceiveName){this.receiveName=receiveName;}publicStringgetReceiveTelephone(){returnreceiveTelephone;}publicvoidsetReceiveTelephone(StringrecieveTelephone){this.receiveTelephone=recieveTelephone;}publicStringgetReceivepary(){returnreceivepary;}publicvoidsetReceivepary(Stringrecievepary){this.receivepary=recievepary;}publicStringgetReceiveAddress(){returnreceiveAddress;}publicvoidsetReceiveAddress(StringreceiveAddress){this.receiveAddress=receiveAddress;}publicStringgetReceivePostcode(){returnreceivePostcode;}publicvoidsetReceivePostcode(StringreceivePostcode){this.receivePostcode=receivePostcode;}publicStringgetControlPosition(){returnControlPosition;}publicvoidsetControlPosition(StringcontrolPosition){ControlPosition=controlPosition;}publicStringgetE*pressSize(){returne*pressSize;}publicvoidsetE*pressSize(Stringe*pressSize){this.e*pressSize=e*pressSize;}}classE*pressMessageDao{publicstaticvoidinsertE*press(E*pressMessagem){if(m.getSendName()==null||m.getSendName().trim().equals("")){JOptionPane.showMessageDialog(null,"寄件人信息必须填写。");return;}if(m.getSendTelephone()==null||m.getSendTelephone().trim().equals("")){JOptionPane.showMessageDialog(null,"寄件人信息必须填写。");return;}if(m.getSendpary()==null||m.getSendpary().trim().equals("")){JOptionPane.showMessageDialog(null,"寄件人信息必须填写。");return;}if(m.getSendAddress()==null||m.getSendAddress().trim().equals("||")){JOptionPane.showMessageDialog(null,"寄件人信息必须填写。");return;}if(m.getSendPostcode()==null||m.getSendPostcode().trim().equals("")){JOptionPane.showMessageDialog(null,"寄件人信息必须填写。");return;}if(m.getReceiveName()==null||m.getReceiveName().trim().equals("")){JOptionPane.showMessageDialog(null,"收件人信息必须填写。");return;}if(m.getReceiveTelephone()==null||m.getReceiveTelephone().trim().equals("")){JOptionPane.showMessageDialog(null,"收件人信息必须填写。");return;}if(m.getReceivepary()==null||m.getReceivepary().trim().equals("")){JOptionPane.showMessageDialog(null,"收件人信息必须填写。");return;}if(m.getReceiveAddress()==null||m.getReceiveAddress().trim().equals("||")){JOptionPane.showMessageDialog(null,"收件人信息必须填写。");return;}if(m.getReceivePostcode()==null||m.getReceivePostcode().trim().equals("")){JOptionPane.showMessageDialog(null,"收件人信息必须填写。");return;}Connectionconn=null;//声明数据库连接//声明PreparedStatement对象PreparedStatementps=null;try{conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句ps=conn.prepareStatement("insertintotb_receiveSendMessage(sendName,sendTelephone,sendpary,sendAddress,sendPostcode,receiveName,recieveTelephone,recievepary,receiveAddress,receivePostcode,ControlPosition,e*pressSize)values(",",",",",",",",",",",")");ps.setString(1,m.getSendName());//为参数赋值ps.setString(2,m.getSendTelephone());ps.setString(3,m.getSendpary());ps.setString(4,m.getSendAddress());ps.setString(5,m.getSendPostcode());ps.setString(6,m.getReceiveName());//为参数赋值ps.setString(7,m.getReceiveTelephone());ps.setString(8,m.getReceivepary());ps.setString(9,m.getReceiveAddress());ps.setString(10,m.getReceivePostcode());ps.setString(11,m.getControlPosition());//为参数赋值ps.setString(12,m.getE*pressSize());intflag=ps.e*ecuteUpdate();if(flag>0){JOptionPane.showMessageDialog(null,"添加成功。");}else{JOptionPane.showMessageDialog(null,"添加失败。");}}catch(E*ceptione*){JOptionPane.showMessageDialog(null,"添加失败!");e*.printStackTrace();}finally{try{if(ps!=null){ps.close();}if(conn!=null){conn.close();}}catch(SQLE*ceptione){e.printStackTrace();}}}publicstaticvoidupdateE*press(E*pressMessagem){Connectionconn=null;//声明数据库连接//声明PreparedStatement对象PreparedStatementps=null;try{conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句ps=conn.prepareStatement("updatetb_receiveSendMessagesetsendName=",sendTelephone=",sendpary=",sendAddress=",sendPostcode=",receiveName=",recieveTelephone=",recievepary=",receiveAddress=",receivePostcode=",ControlPosition=",e*pressSize="whereid="");ps.setString(1,m.getSendName());//为参数赋值ps.setString(2,m.getSendTelephone());ps.setString(3,m.getSendpary());ps.setString(4,m.getSendAddress());ps.setString(5,m.getSendPostcode());ps.setString(6,m.getReceiveName());//为参数赋值ps.setString(7,m.getReceiveTelephone());ps.setString(8,m.getReceivepary());ps.setString(9,m.getReceiveAddress());ps.setString(10,m.getReceivePostcode());ps.setString(11,m.getControlPosition());//为参数赋值ps.setString(12,m.getE*pressSize());ps.setInt(13,m.getId());intflag=ps.e*ecuteUpdate();if(flag>0){JOptionPane.showMessageDialog(null,"修改成功。");}else{JOptionPane.showMessageDialog(null,"修改失败。");}}catch(E*ceptione*){JOptionPane.showMessageDialog(null,"修改失败!"+e*.getMessage());e*.printStackTrace();}finally{try{if(ps!=null){ps.close();}if(conn!=null){conn.close();}}catch(SQLE*ceptione){e.printStackTrace();}}}publicstaticVector<E*pressMessage>queryE*press(){Connectionconn=null;//声明数据库连接//声明PreparedStatement对象PreparedStatementps=null;try{conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句ps=conn.prepareStatement("selectsendName,sendTelephone,sendpary,sendAddress,sendPostcode,receiveName,recieveTelephone,recievepary,receiveAddress,receivePostcode,ControlPosition,e*pressSizefromtb_receiveSendMessage");ResultSetrs=ps.e*ecuteQuery();Vector<E*pressMessage>v=newVector<E*pressMessage>();while(rs.ne*t()){E*pressMessagem=newE*pressMessage();m.setSendName(rs.getString(1));m.setSendTelephone(rs.getString(2));m.setSendpary(rs.getString(3));m.setSendAddress(rs.getString(4));m.setSendPostcode(rs.getString(5));m.setReceiveName(rs.getString(6));m.setReceiveTelephone(rs.getString(7));m.setReceivepary(rs.getString(8));m.setReceiveAddress(rs.getString(9));m.setReceivePostcode(rs.getString(10));m.setControlPosition(rs.getString(11));m.setE*pressSize(rs.getString(12));v.add(m);}returnv;}catch(E*ceptione*){e*.printStackTrace();returnnull;}finally{try{if(ps!=null){ps.close();}if(conn!=null){conn.close();}}catch(SQLE*ceptione){e.printStackTrace();}}}publicstaticVector<E*pressMessage>queryAllE*press(){Connectionconn=null;//声明数据库连接//声明PreparedStatement对象PreparedStatementps=null;try{conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句ps=conn.prepareStatement("selectid,sendName,sendTelephone,sendpary,sendAddress,sendPostcode,receiveName,recieveTelephone,recievepary,receiveAddress,receivePostcode,ControlPosition,e*pressSizefromtb_receiveSendMessage");ResultSetrs=ps.e*ecuteQuery();Vector<E*pressMessage>v=newVector<E*pressMessage>();while(rs.ne*t()){E*pressMessagem=newE*pressMessage();m.setId(rs.getInt(1));m.setSendName(rs.getString(2));m.setSendTelephone(rs.getString(3));m.setSendpary(rs.getString(4));m.setSendAddress(rs.getString(5));m.setSendPostcode(rs.getString(6));m.setReceiveName(rs.getString(7));m.setReceiveTelephone(rs.getString(8));m.setReceivepary(rs.getString(9));m.setReceiveAddress(rs.getString(10));m.setReceivePostcode(rs.getString(11));m.setControlPosition(rs.getString(12));m.setE*pressSize(rs.getString(13));v.add(m);}returnv;}catch(E*ceptione*){e*.printStackTrace();returnnull;}finally{try{if(ps!=null){ps.close();}if(conn!=null){conn.close();}}catch(SQLE*ceptione){e.printStackTrace();}}}}classDAO{privatestaticDAOdao=newDAO();//声明DAO类的静态实例/***构造方法,加载数据库驱动*/publicDAO(){try{Class.forName("net.sourceforge.jtds.jdbc.Driver");//加载数据库驱动}catch(ClassNotFoundE*ceptione){JOptionPane.showMessageDialog(null,"数据库驱动加载失败,请将JTDS驱动配置到构建路径中。\n"+e.getMessage());}}/***获得数据库连接的方法**returnConnection*/publicstaticConnectiongetConn(){try{Connectionconn=null;//定义数据库连接Stringurl="jdbc:jtds:sqlserver://localhost:1433/db_E*pressPrint";//数据库db_E*press的URLStringusername="sa";//数据库的用户名Stringpassword="";//数据库密码conn=DriverManager.getConnection(url,username,password);//建立连接returnconn;//返回连接}catch(E*ceptione){JOptionPane.showMessageDialog(null,"数据库连接失败。\n请检查数据库用户名和密码是否正确。"+e.getMessage());returnnull;}}}classUserDao{/***判断用户名和密码的方法**paramuser*实体类User的实例*/publicstaticbooleanokUser(Useruser){Connectionconn=null;try{Stringusername=user.getName();Stringpwd=user.getPwd();conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句PreparedStatementps=conn.prepareStatement("selectpasswordfromtb_userwhereusername="");ps.setString(1,username);//为参数赋值ResultSetrs=ps.e*ecuteQuery();//执行SQL语句,获得查询结果集if(rs.ne*t()&&rs.getRow()>0){//查询到用户信息Stringpassword=rs.getString(1);//获得密码if(password.equals(pwd)){SaveUserStateTool.setUsername(username);SaveUserStateTool.setPassword(pwd);returntrue;//密码正确返回true}else{JOptionPane.showMessageDialog(null,"密码不正确。");returnfalse;//密码错误返回false}}else{JOptionPane.showMessageDialog(null,"用户名不存在。");returnfalse;//用户不存在返回false}}catch(E*ceptione*){JOptionPane.showMessageDialog(null,"数据库异常!\n"+e*.getMessage());returnfalse;//数据库异常返回false}finally{if(conn!=null){try{conn.close();}catch(SQLE*ceptione){e.printStackTrace();}}}}/***添加用户信息的方法**paramuser*实体类User的实例*/publicstaticvoidinsertUser(Useruser){Connectionconn=null;try{Stringusername=user.getName();//获得用户名Stringpwd=user.getPwd();//获得密码StringokPwd=user.getOkPwd();//获得确认密码if(username==null||username.trim().equals("")||pwd==null||pwd.trim().equals("")||okPwd==null||okPwd.trim().equals("")){JOptionPane.showMessageDialog(null,"用户名或密码不能为空。");return;}if(!pwd.trim().equals(okPwd.trim())){JOptionPane.showMessageDialog(null,"两次输入的密码不一致。");return;}conn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句PreparedStatementps=conn.prepareStatement("insertintotb_user(username,password)values(",")");ps.setString(1,username.trim());//为参数赋值ps.setString(2,pwd.trim());//为参数赋值intflag=ps.e*ecuteUpdate();//执行SQL语句if(flag>0){JOptionPane.showMessageDialog(null,"添加成功。");}else{JOptionPane.showMessageDialog(null,"添加失败。");}}catch(E*ceptione*){JOptionPane.showMessageDialog(null,"用户名重复,请换个名称!");return;}finally{try{if(conn!=null){conn.close();//关闭数据库连接对象}}catch(E*ceptione*){}}}/***修改用户密码的方法**paramoldPwd*原密码*paramnewPwd*新密码*paramokPwd*确认新密码*/publicstaticvoidupdateUser(StringoldPwd,StringnewPwd,StringokPwd){try{if(!newPwd.trim().equals(okPwd.trim())){JOptionPane.showMessageDialog(null,"两次输入的密码不一致。");return;}if(!oldPwd.trim().equals(SaveUserStateTool.getPassword())){JOptionPane.showMessageDialog(null,"原密码不正确。");return;}Connectionconn=DAO.getConn();//获得数据库连接//创建PreparedStatement对象,并传递SQL语句PreparedStatementps=conn.prepareStatement("updatetb_usersetpassword="whereusername="");ps.setString(1,newPwd.trim());//为参数赋值ps.setString(2,SaveUserStateTool.getUsername());//为参数赋值intflag=ps.e*ecuteUpdate();//执行SQL语句if(flag>0){JOptionPane.showMessageDialog(null,"修改成功。");}else{JOptionPane.showMessageDialog(null,"修改失败。");}ps.close();conn.close();//关闭数据库连接}catch(E*ceptione*){JOptionPane.showMessageDialog(null,"数据库异常!"+e*.getMessage());return;}}}classTest{privatestaticString[]split(Stringte*t){intlength=te*t.length();if(length<20){returnnewString[]{te*t};}elseif(length%20==0){//如果字符串长度是20的整数倍length/=20;//截取后字符串的个数是长度除20的商String[]subStrings=newString[length];for(inti=0;i<subStrings.length;i++){//使用循环截取subStrings[i]=te*t.substring(20*i,20*(i+1));}returnsubStrings;}else{//如果字符串长度不是20的整数倍length=length/20+1;//截取后字符串的个数是长度除20的商再加一String[]subStrings=newString[length];for(inti=0;i<subStrings.length-1;i++){//使用循环截取20整数倍的字符串subStrings[i]=te*t.substring(20*i,20*(i+1));}//截取尾部剩余的字符串subStrings[length-1]=te*t.substring(20*(length-1),te*t.length());returnsubStrings;}}publicstaticvoidmain(String[]args){Stringte*t="123456";String[]array=split(te*t);System.out.println(Arrays.toString(array));}}classSaveUserStateTool{privatestaticStringusername=null;privatestaticStringpassword=null;publicstaticvoidsetUsername(Stringusername){SaveUserStateTool.username=username;}publicstaticStringgetUsername(){returnusername;}publicstaticvoidsetPassword(Stringpassword){SaveUserStateTool.password=password;}publicstaticStringgetPassword(){returnpassword;}}classBackgroundPanele*tendsJPanel{privatestaticfinallongserialVersionUID=1L;privateImageimage;//定义图像对象publicBackgroundPanel(Imageimage){super();//调用超类的构造方法this.image=image;//为图像对象赋值initialize();}/**重写paintponent方法*/Overrideprotectedvoidpaintponent(Graphicsg){super.paintponent(g);//调用父类的方法Graphics2Dg2=(Graphics2D)g;//创建Graphics2D对象if(image!=null){intwidth=getWidth();//获得面板的宽度intheight=getHeight();//获得面板的高度//绘制图像g2.drawImage(image,0,0,width,height,this);}}privatevoidinitialize(){this.setSize(300,200);}}classUpdatePasswordFramee*tendsJFrame{privatestaticfinallongserialVersionUID=1L;privateJPaneljContentPane=null;privateJLabeljLabel=null;privateJLabeljLabel1=null;privateJLabeljLabel2=null;privateJPasswordFieldpf_oldPwd=null;privateJPasswordFieldpf_newPwd=null;privateJPasswordFieldpf_okNewPwd=null;privateuttonbtn_update=null;privateuttonbtn_return=null;/***Thismethodinitializespf_oldPwd**returnjava*.swing.JPasswordField*/privateJPasswordFieldgetPf_oldPwd(){if(pf_oldPwd==null){pf_oldPwd=newJPasswordField();pf_oldPwd.setBounds(newRectangle(93,21,185,22));pf_oldPwd.setEchoChar('*');pf_oldPwd.addActionListener(newjava.awt.event.ActionListener(){OverridepublicvoidactionPerformed(java.awt.event.ActionEvente){pf_newPwd.requestFocus();}});}returnpf_oldPwd;}/***Thismethodinitializespf_newPwd**returnjava*.swing.JPasswordField*/privateJPasswordFieldgetPf_newPwd(){if(pf_newPwd==null){pf_newPwd=newJPasswordField();pf_newPwd.setBounds(newRectangle(94,54,182,22));pf_newPwd.setEchoChar('*');pf_newPwd.addActionListener(newjava.awt.event.ActionListener(){OverridepublicvoidactionPerformed(java.awt.event.ActionEvente){pf_okNewPwd.requestFocus();}});}returnpf_newPwd;}/***Thismethodinitializespf_okNewPwd**returnjava*.swing.JPasswordField*/privateJPasswordFieldgetPf_okNewPwd(){if(pf_okNewPwd==null){pf_okNewPwd=newJPasswordField();pf_okNewPwd.setBounds(newRectangle(94,90,182,22));pf_okNewPwd.setEchoChar('*');pf_okNewPwd.addActionListener(newjava.awt.event.ActionListener(){OverridepublicvoidactionPerformed(java.awt.event.ActionEvente){StringoldPwd=newString(pf_oldPwd.getPassword());StringnewPwd=newString(pf_newPwd.getPassword());StringokPwd=newString(pf_okNewPwd.getPassword());UserDao.updateUser(oldPwd,newPwd,okPwd);}});}returnpf_okNewPwd;}/***Thismethodinitializesbtn_update**returnjava*.swing.utton*/privateuttongetBtn_update(){if(btn_update==null){btn_update=newutton();btn_update.setBounds(newRectangle(40,123,75,27));btn_update.setTe*t("修改");btn_update.addActionListener(newjava.awt.event.ActionListener(){OverridepublicvoidactionPerformed(java.awt.event.ActionEvente){StringoldPwd=newString(pf_oldPwd.getPassword());//获得原密码StringnewPwd=newString(pf_newPwd.getPassword());//获得新密码StringokPwd=newString(pf_okNewPwd.getPassword());//获得确认密码UserDao.updateUser(oldPwd,newPwd,okPwd);//更新密码}});}returnbtn_update;}/***Thismethodinitializesbtn_return**returnjava*.swing.utton*/privateuttongetBtn_return(){if(btn_return==null){btn_return=newutton();btn_return.setBounds(newRectangle(162,124,82,26));btn_return.setTe*t("返回");btn_return.addActionListener(newjava.awt.event.ActionListener(){OverridepublicvoidactionPerformed(java.awt.event.ActionEvente){dispose();}});}returnbtn_return;}/***Thisisthedefaultconstructor*/publicUpdatePasswordFrame(){super();initialize();}/***Thismethodinitializesthis**returnvoid*/privatevoidinitialize(){this.setSize(317,205);this.setContentPane(getJContentPane());this.setTitle("修改用户密码");}/***ThismethodinitializesjContentPane**returnjava*.swing.JPanel*/privateJPanelgetJContentPane(){if(jContentPane==null){jLabel2=newJLabel();jLabel2.setBounds(newRectangle(19,86,73,27));jLabel2.setTe*t("确认密码:");jLabel1=newJLabel();jLabel1.setBounds(newRectangle(20,52,70,27));jLabel1.setTe*t("新密码:");jLabel=newJLabel();jLabel.setBounds(newRectangle(18,18,71,27));jLabel.setTe*t("原密码:");jContentPane=newJPanel();jContentPane.setLayout(null);jContentPane.add(jLabel,null);jContentPane.add(jLabel1,null);jContentPane.add(jLabel2,null);jContentPane.add(getPf_oldPwd(),null);jContentPane.add(getPf_newPwd(),null);jContentPane.add(getPf_okNewPwd(),null);jContentPane.add(getBtn_update(),null);jContentPane.add(getBtn_return(),null);}returnjContentPane;}}classUpdateE*pressFramee*tendsJFrame{privatestaticfinallongserialVersionUID=1L;privateJPaneljContentPane=null;privateURLurl=null;//声明图片的URLprivateImageimage=null;//声明图像对象privateBackgro
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年度股权投资合同详尽范本
- 2024年度某企业员工健康保险服务合同
- 2024年度矿井开采用起重机维修合同
- 2024年度工程监理合同及监理要求3篇
- 2024年度基于云计算的金融服务系统开发合同3篇
- 2024年度秦皇岛市供气合同3篇
- 四年级英语课件
- 【高中化学导学案】新课标高中化学必修一全册导学案(习题附参考答案)
- 《价格的谈判技巧》课件
- 幕墙施工组织方案书
- 2024年江苏省苏州市中考语文试卷
- 车辆工程基础知识单选题100道及答案解析
- 2024-2030年中国天然蜂蜜市场竞争状况与盈利前景预测报告
- 文书模板-《企业防静电方案》
- 油气田开发工程车辆租赁合同
- 小标题式作文公开课获奖课件省赛课一等奖课件
- 中国厨房电器行业消费态势及销售状况分析研究报告(2024-2030版)
- 2024年安徽省投资集团控股限公司社会招聘高频难、易错点练习500题附带答案详解
- 24秋国家开放大学《公共关系学》实训任务(5)答案
- 海南省海口市海南省华侨中学2024-2025年八年级上期中考试物理试题(含答案)
- 孕产妇艾梅乙健康宣教
评论
0/150
提交评论