数据库系统课程设计-仓库管理系统-java-_第1页
数据库系统课程设计-仓库管理系统-java-_第2页
数据库系统课程设计-仓库管理系统-java-_第3页
数据库系统课程设计-仓库管理系统-java-_第4页
数据库系统课程设计-仓库管理系统-java-_第5页
已阅读5页,还剩76页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

页脚内容一、选择题一、选择题页脚内容 一、选择题(设计思路、实现功能、运用技术)P7实现及操作)P17存在问题和需要改善的地方P18附录(完整代码包括分布调试代码)页脚内容 一、选择题插入、删除等基本功能,功能越强大越好。根据题目的基本需求,设计数据库、编写程序,并写出详细的设计说明书。需要提交的文档资料:设计说明书每人一份(包括:参考资料的阅读心得,功能需求说明,设计思路,数据表结构及作用,数据关系图,存储过程代码及相关注释,设计体会);课程设计说明书编写规范:d.安全性设计:登录用户、数据库用户、数据库角色、命令许可等方面。查询、插入、删除与更新。涉及到数据的所有操作要求采用存储过程的方式进行。f.附录或参考资料:参考资料来源,阅读心得。页脚内容 一、选择题参考资料(老师提供):系,并通过编写存储过程来实现其中的两项功能:(1)教材入库并更新在库教材信息表。教材入库后把教材征订单相应项目做教材收到标记。(暂不处(2)教材出库间,出库数量,使用单位(指班级或教师,可多个班级或教师),用途,经办人等信息入,可通过班级名称、课程名称或教材名称查询到要出库的教材信息表中相应教材的内(3)教材信息录入内部识别号(由本系统自动维护),代号,书名,编著者,出版社,版次,定价,入库时间,入库数,适用对象等信息录入到系统的数据库中。2)、教材查询(1)在库教材查询(2)教材出库查询教材出库信息查询:其他人员)的教材出库情况。可查询某时间范围内(学期、学年等)的教材出库情况。(3)教材历史查询查询指定书的在库及出入库的历史信息,也可按时间或时间范围查询教材入库情3)、教材订购(1)、生成教材订单根据输入的各专业班级课程教材选用信息、教材出版社信息生成订单。(2)、教材订单状态管理订单为有效(款项发出),图书入库后标记订单为到货,4)、教材订单查询5)、其他相关数据:学生相关、课程相关、教师相关、班级相关、系部相关页脚内容 一、选择题(1).这个实验本质就是设置合理的操作界面,实现对数据库的数据读取、修改、(2).系统的完备性和操作的安全性,是完善软件的关键,其中包括:;;(3)界面的美化和操作的快捷性和正确性;界面是给客户的第一感触,尽量的新颖并且符合客户要求:;(4)分工与合作a页脚内容 一、选择题(1).仓库管理系统,实现功能:(2).附加实现功能:登录界面:实现管理员员和客户的不同角色登录;界面的转换:分别创建不同的窗口,并及时删除浏览过的窗口;(2)数据路操作实现:使用Access2003,运用SQL语言进行操作;页脚内容一、选择题一、选择题DBAccess:实现连接,查询修改等分步操作;GetDBInfo:实现查询结果集的返回;Select:功能选择界面InStoreHouse:物品入库操作界面OutStoreHouse:物品出库操作界面SearchGoods:物品查询界面OutIn:出入库查询界面ManagerInfo:管理员信息管理界面1.DBAccess类publicStatementgetStatement(StringdbPath)throwsException:返回连接数据库的状态;publicResultSetexecuteQuery(Statementstmt,Stringquery)throwsException:publicvoidexecuteUpdate(Statementstmt,Stringquery)throwsSQLException:更新数据库;publicvoidclose()throwsSQLException:关闭数据库的连接;2.GetDBInfo类privateVector<Vector<String>>rows;记录查询返回元组privateVectorcolumnHeads;记录查询返回结果的标题publicVectorgetColumnHeads();//获取表中内容publicVectorgetRows();//更新数据库publicvoidexecuteUpdate(Statementstmt,Stringquery)throwsSQLException;3.Enter类privateJFrameframe;页脚内容一、选择题privateJButtonenterButton;privateJButtonresetButton;用于标识登陆角色的单选按钮privateJRadioButtonradioButton1;privateJRadioButtonradioButton2;privateJTextFieldnameText;privateJPasswordFieldpasswordText;表示登录身份:publicstaticbooleanisManager=false;(1)图片载入:JLabellabel4=newJLabel();ImageIconicon=newImageIcon("E:\\study\\java\\workspace\\StoreHouse\\abc.jpg");label4.setIcon(icon);(2)单选按钮:ButtonGroupgroup=newButtonGroup();radioButton1=newJRadioButton("管理员",false);radioButton2=newJRadioButton("客户",true);group.add(radioButton1);group.add(radioButton2);4.InStoreHouse类privateJFrameframe;privateJTextFieldinfoText;privateJButtonokButton;privateJButtonbackButton;设置日期格式:privatestaticfinalStringYYYMMDDHHMMSS="yyyy/MM/ddHH:mm:ss";页脚内容一、选择题publicStringgetSQL()//自动生成插入时间publicStringinsertTime()publicStringinHouseID()//清除文本框publicvoidclear()publicvoidactionPerformed(ActionEvente){Objectsource=e.getSource();if(source==okButton){DBAccessdb=newDBAccess();StringdbPath="E:\\study\\java\\workspace\\StoreHouse\\StoreHouse.mdb";Statementstmt=db.getStatement(dbPath);Stringquery=getSQL();db.executeUpdate(stmt,query);query=insertSQL();db.executeUpdate(stmt,query);stmt.close();db.close();infoText.setText("存储成功");clear();}catch(Exceptionex){ex.printStackTrace();一、选择题}}elseif(source==backButton){frame.dispose();newSelect();}}5.OutStoreHouse类privateJFrameframe;privateJButtonokButton;privateJButtonbackButton;privateJTextFieldtext1;privateJTextFieldtext2;privateJTextFieldtext3;privateJTextFieldtext4;privatestaticfinalStringYYYMMDDHHMMSS="yyyy/MM/ddHH:mm:ss";privateIntegernum;//修改数据里中数量的临时变量处理物品编号不存在,以及数量不足的问题:publicvoidactionPerformed(ActionEvente){Objectsource=e.getSource();if(source==okButton){DBAccessdb=newDBAccess();StringdbPath="E:\\study\\java\\workspace\\StoreHouse\\StoreHouse.mdb";Stringquery=getGoodsSQL();页脚内容 一、选择题Statementstmt=db.getStatement(dbPath);ResultSetrs=db.executeQuery(stmt,query);{JOptionPane.showMessageDialog(null,"输入货物编号不存在","提示信息",JOptionPane.INFORMATION_MESSAGE);text3.setText("操作失败");clear();e//判断仓库物品是否够//这里实验了很多次为什么只有num=放在这里才可以呢if((num=Integer.valueOf(rs.getString(1)).intValue()-Integer.valueOf(text2.getText()).intValue())<0){JOptionPane.showMessageDialog(null,"仓库货物不足","提示信息",JOptionPane.INFORMATION_MESSAGE);clear();text3.setText("操作失败");query=getSendOutSQL();db.executeUpdate(stmt,query);query=updateGoodsSQL(num);db.executeUpdate(stmt,query);text3.setText("操作成功");}}stmt.close();db.close();}catch(Exceptionex){ex.printStackTrace();}}elseif(source==backButton){frame.dispose();newSelect();}}6.SearchGoods类页脚内容一、选择题privateJFrameframe;privateJScrollPanejsp;privateJComboBoxnameList;privateJComboBoxtypeList;privateJComboBoxproductList;privateJTextFieldcountText;privateJTextFieldvalueText;privateJButtonokButton;privateJTabletable;privateDefaultTableModelmodel;privateJButtonbackButton;privateVectorrows;//表行值privateVectorcolumnHeads;//表列名//查询使用:Stringstr1,str2,str3;privateJFrameframe;privateJRadioButtoninButton;privateJRadioButtonoutButton;privateJButtonokButton;privateJButtonbackButton;privateJComboBoxcombox1;privateJComboBoxcombox2;privateJTabletable;privateVectorrows;//表行值privateVectorcolumnHeads;//表列名privateDefaultTableModelmodel;privateJScrollPanejsp;privateStringstr1=null,str2=null;//查询使用一、选择题privatebooleanflag=false;privateinttmp=0;privatestaticfinalStringYYYMMDDHHMMSS="yyyy/MM/dd";时间字符创的分割处理;8.Select类基本成员变量privateJButtonbutton1;privateJButtonbutton2;privateJButtonbutton3;privateJButtonbutton4;privateJButtonbutton5;privateJButtonbutton6;privateJTextFieldText;privateJFrameframe;infoLabel.setHorizontalAlignment(SwingConstants.CENTER);infoLabel.setBackground(Color.gray);页脚内容 一、选择题Text.setBackground(Color.gray);Text.setForeground(Color.cyan);Text.setFont(newFont("宋体",Font.HANGING_BASELINE,20));9.ManagerInfo类privateJFrameframe;privateJTabbedPanetabbedPane;privateJLabellabel1;privateJLabellabel2;privateJLabellabel3;privateJPanelpanel1;privateJPanelpanel2;privateJPanelpanel3;privateJComboBoxageBox;privateJComboBoxworkAgeBox;privateJComboBoxpostionBox;privateJTextFieldtext21;privateJTextFieldtext22;privateJTextFieldtext23;privateJTextFieldtext24;privateJTextFieldtext25;privateJTextFieldtext26;privateJTextFieldtext27;privateJTextFieldtext28;privateJTextFieldtext31;privateJTextFieldtext32;privateJButtonbutton11;privateJButtonbutton12;privateJButtonbutton21;privateJButtonbutton31;privateJButtonbackButton;privateJTabletable;privateVectorrows;//表行值privateVectorcolumnHeads;//表列名privateDefaultTableModelmodel;privateJScrollPanejsp;privateStringstr1=null,str2=null,str3=null;//查询使用页脚内容一、选择题一、选择题页脚内容 一、选择题if(source==button31){booleandeleteState=false;try{DBAccessdb=newDBAccess();StringdbPath="E:\\study\\java\\workspace\\StoreHouse\\StoreHouse.mdb";Stringquery="select*fromManagerwhere编号="+"'"+text31.getText()+"'";Statementstmt=db.getStatement(dbPath);ResultSetrs=db.executeQuery(stmt,query);if(rs.getString(1).equals(text31.getText())){query="deletefromManagerwhere编号="+"'"+text31.getText()+"'";db.executeUpdate(stmt,query);text31.setText("");text32.setText("删除成功");deleteState=true;}}stmt.close();db.close();}catch(Exceptionex){ex.printStackTrace();}if(deleteState==false){text32.setText("输入编号不存在");text31.setText("");}在删除之前,对数据库进行检查,判断管理员编号是否存在;页脚内容 一、选择题存在问题和需要完善的问题页脚内容 一、选择题onageretptionentpublicclassDBAccess{ublicConnectionconnnull未加密的数据库ntStringpublicntStringrowsExceptionClassforNamesunjdbcodbcJdbcOdbcDriver);Stringdburl="jdbc:odbc:driver={MicrosoftAccessDriver(*.mdb)};"+//Stringdburlconn=DriverManagergetConnectiondburlturnconncreateStatement}据库publicStatementgetStatement(StringringpasswordthrowsExceptionClassforNamesunjdbcodbcJdbcOdbcDriver);dbcodbcdriverdbcodbcdriverMicrosoftcessmdbpwdpasswordDBQ="+dbPath;//此//Stringdburlconn=DriverManagergetConnectiondburl);turnconncreateStatement}publicResultSetexecuteQuery(StatementthrowsExceptionSetsstmtexecuteQueryqueryurnrs}更新数据库publicvoidexecuteUpdate(StatementrythrowsSQLExceptionatequery}关闭链接publicvoidclosethrowsSQLExceptione}publicstaticvoidmain(Stringargs[])throwsException{DBAccessdbnewDBAccess);dbPathEstudyjavaworkspaceStoreHouseSringqueryselectfromManagermentdbPathResultSetrs=db.executeQuery(stmt,temoutprintlnrsgetStringt"+rs.getString(2)+"\t"页脚内容 一、选择题rsgetString(4)+"\t"+rs.getString(5)+rsgetStringrs.getString(7));}}}etentblicclassEnterimplementsActionListenerprivateJFrameframe;privateJButtonenterButton;rivateJButtonresetButtonprivateJRadioButtonradioButton1;privateJRadioButtonradioButton2;privateJTextFieldnameText;vateJPasswordFieldpasswordTextpublicstaticbooleanisManagerfalse;ublicEnterframe=newJFrame("仓库管理系统登录界面");ttonnewJButtonresetButtonnewJButton;elbelJLabellabel3=newJLabel("登录方");JLabellabelnewJLabel);JLabellabelnewJLabel);JLabellabelnewJLabel);JLabellabelnewJLabel);ImageIconicon=newconEstudyjavaworkspaceStoreHousetlabel6.setText("中心软件,让您选择无悔的软件,感谢支持晓伟O(∩_∩)O~制作ameTextnewJTextFieldpasswordTextnewJPasswordField;ButtonGroupgroup=newButtonGroup();ttonuttongroup.add(radioButton1);group.add(radioButton2);格式设置ignmentSwingConstantsignmentSwingConstantsignmentSwingConstantsignmentSwingConstants.CENTER);ignmentSwingConstants.CENTER);label1.setFont(newFont("宋体NGINGBASELINElabel2.setFont(newFont("宋体NGINGBASELINElabel5.setFont(newFont("华文行楷NGINGBASELINE页脚内容 一、选择题label7.setFont(newFont("华文行楷NGINGBASELINEdColorreddColorred布局BoundssetBoundssetBoundssetBoundssetBoundslabelsetBounds,180,150,60);nameTextsetBounds20,200,40);passwordTextsetBounds90,200,40);lsetBoundsradioButtonsetBounds250,100,40);radioButtonsetBounds00,100,40);enterButtonsetBounds70,150,40);ndsaddActionListenerthistButtonaddActionListenerthis布局neyoutnullctn.add(label1);ctn.add(label2);ctn.add(nameText);ctn.add(passwordText);ctn.add(label3);eleleleloButtonctn.add(radioButton2);ctn.add(enterButton);ctn.add(resetButton);tVisibletrueframesetBounds,400);efaultCloseOperationJFrameEXITONCLOSE);}licvoidactionPerformedActionEventebooleantmp=false;ObjectsourceegetSourcettonDBAccessdbnewDBAccessdbPathEstudyjavaworkspaceStoreHouseSStringquery="select*fromostmentdbPathSetrsdbexecuteQuerystmtquery);if(nameText.getText().equals(rs.getString(1))&&passwordTextgetTextequalsrsgetString))){tmp=true;Selectselect=newbreak;}}stmt.close(); 一、选择题dbcloseimportjavax.swing.JOptionPane;ptionexkTrace}if(tmp==false){JOptionPane.showMessageDialog(null,"输入密ptionPaneINFORMATIONMESSAGEnameTextsetTextpasswordText.setText("");}ourceresetButtonnameTextsetTextpasswordText.setText("");urceradioButtonisManager=true;urceradioButtonisManager=false;}}ublicvoiddisposedispose}publicstaticbooleanisManagerreturnisManager;}publicstaticvoidmainStringargs){EntertestnewEnter();}}GetDBInfo.java文件ageretetaDataptionentpublicclassGetDBInfo{privateVectorVectorStringrowsprivateVectorcolumnHeads;publicGetDBInfo(StringDBInfo,StringClassforNamesunjdbcodbcJdbcOdbcDriverStringdburl="jdbc:odbc:driver={MicrosoftAccessDriverConnectionconn=DriverManagergetConnectiondburlStatementstate=StatementSettateexecuteQueryselStrif(!(rs.next()))//判断数据库中是否有内容{JOptionPaneshowMessageDialognull"结果集中无记录","无记录eINFORMATIONMESSAGE}etMetaDatarsmdrsgetMetaData;//获得结果集列属性值rowsnewVector;olumnHeadsnewVectorntlumnCountidsaddElementrsmdgetColumnNamei名}页脚内容 一、选择题rscloseceptionee.printStackTrace();}}blicVectorgetColumnHeadsreturncolumnHeads;}表中内容publicVectorgetRowsreturnrows;}行的值方法privateVectorgetNextRow(ResultSetrsResultSetMetaDatarsmdthrowsSQLExceptionewVectormnCountiowaddElementrsgetStringi}rncurrentRow}新数据库publicvoidexecuteUpdate(StatementrythrowsSQLExceptionatequery}publicstaticvoidmainStringargs]){GetDBInfotest=newGetDBInfoEstudy\java\\workspace\\StoreHouseStoreHousemdb"select*fromPutIn");System.out.println(test.getRows());temoutprintlntestgetColumnHeads}}entimportjava.text.SimpleDateFormat;importjava.util.Date;publicclassInStoreHouseimplementsActionListener{privateJFrameframe;privateJTextFieldtext1;privateJTextFieldtext2;privateJTextFieldtext3;privateJTextFieldtext4;privateJTextFieldtext5;privateJTextFieldtext6;privateJTextFieldtext7;privateJTextFieldtext8;privateJTextFieldtext9;privateJTextFieldtext10;privateJTextFieldtext11;privateJTextFieldinfoText;privateJButtonokButton;privateJButtonbackButton;privatestaticfinalStringYYYMMDDHHMMSS=HmmssblicInStoreHouseframenewJFrame);TextFieldTextFieldTextFieldTextFieldTextFieldTextFieldTextFieldTextFieldJTextFieldnewJTextFieldnewJTextFieldld页脚内容 一、选择题okButtonnewJButton;JLabelinfoLabel=newJLabel("填写信JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel;JLabellabelnewJLabel("种类");格式设置infoLabel.setFont(newFont("仿宋ERBASELINElabel1.setFont(newFont("仿宋ERBASELINEAlignmentSwingConstants.CENTER);ckgroundColorlightGraylabel2.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel3.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel4.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ackgroundColorlightGraylabel5.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel6.setFont(newFont("仿宋ERBASELINElignmentSwingConstants.CENTER);ckgroundColorlightGraylabel7.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel8.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel9.setFont(newFont("仿宋ERBASELINEignmentSwingConstants.CENTER);ckgroundColorlightGraylabel10.setFont(newFont("仿宋ERBASELINEtBackgroundColorlightGraylabel11.setFont(newFont("仿宋ERBASELINEtBackgroundColorlightGraytBoundslabelsetBounds;textsetBounds30);labelsetBounds;text2.setBounds(460,40,140,30);页脚内容 一、选择题BoundstextsetBounds30);labelsetBounds30);textsetBounds30);BoundstextsetBounds30);labelsetBounds30);textsetBounds30);labelsetBoundstextsetBounds,30);labelsetBounds30);textsetBounds30);labelsetBoundstextsetBounds30);setBoundstextsetBounds0);labelsetBounds,30);textsetBounds0);tsetBoundsokButtonsetBounds320,150,30);backButtonsetBounds,320,150,30);addActionListenerthisackButtonaddActionListenerthiseyoutnullctn.add(infoLabel);ctn.add(label1);ctn.add(text1);ctn.add(label2);ctn.add(text2);ctn.add(label3);ctn.add(text3);ctn.add(label4);ctn.add(text4);ctn.add(label5);ctn.add(text5);ctn.add(label6);ctn.add(text6);ctn.add(label7);ctn.add(text7);ctn.add(label8);ctn.add(text8);ctn.add(label9);ctn.add(text9);ctn.add(label10);xtctn.add(label11);extctn.add(infoText);ctn.add(okButton);ctn.add(backButton);tVisibletrue//frame.setResizable(false);framesetBounds,400);faultCloseOperationJFrameDISPOSE_ON_CLOSE);ystemoutprintlngetSQL}publicStringgetSQL{Stringtem=null;teminsertintoGoods"+lues+"'"+text2.getText()+"'"+","textgetText+","textgetText"+","+inHouseID()+"'"+")";returntem;}publicStringinsertTimengtmpnullDatenowDatenewDate();SimpleDateFormatsf=new页脚内容 一、选择题DateFormatYYYMMDDHHMMSSormatnowDatetoStringreturntmp;}publicStringinHouseID){ext}publicStringinsertSQL){Stringtmp=null;tmp="insertintoPutIn"esreturntmp;}publicvoidclear){text1.setText("");text2.setText("");text3.setText("");text4.setText("");text5.setText("");text6.setText("");text7.setText("");text8.setText("");text9.setText("");text10.setText("");}publicvoidactionPerformedActionEvente){ObjectsourceegetSourceDBAccessdbnewDBAccessbPathEstudyjavaworkspaceStoreHouseSementdbPathingquerygetSQLdb.executeUpdate(stmt,query);query=insertSQL();db.executeUpdate(stmt,query);db.close();tclear();ptionexkTrace}rcebackButtonramedisposenewSelect();}}publicstaticvoidmainStringargs[]){}}aefaultTableModeletentpublicclassManagerInfoimplementsActionListenerprivateJFrameframe;privateJTabbedPanetabbedPane;privateJLabellabel1;privateJLabellabel2;privateJLabellabel3;privateJPanelpanel1;privateJPanelpanel2;privateJPanelpanel3;privateJComboBoxageBox;privateJComboBoxworkAgeBox;页脚内容 一、选择题privateJComboBoxpostionBox;privateJTextFieldtext21;privateJTextFieldtext22;privateJTextFieldtext23;privateJTextFieldtext24;privateJTextFieldtext25;privateJTextFieldtext26;privateJTextFieldtext27;privateJTextFieldtext28;privateJTextFieldtext31;privateJTextFieldtext32;privateJButtonbutton11;privateJButtonbutton12;privateJButtonbutton21;privateJButtonbutton31;privateJButtonbackButton;privateJTabletable;privateVectorrows;//表行值privateVectorcolumnHeads;//表列名privateDefaultTableModelmodel;privateJScrollPanejsp;null//查询使用ublicManagerInfoframenewJFrame询");PanenewJTabbedPanewJLabellabel3=newJLabel();panelnewJPanel;panelnewJPanel;panelnewJPanel;paneladdlabelpaneladdlabelpaneladdlabeltabbedPane.addTab("查询信息",null,panel1,"label1");tabbedPane.addTab("录入信息",panel2);tabbedPane.addTab("删除信息",panel3);息面板JLabellabelnewJLabel("年龄");JLabellabelnewJLabel("工龄");JLabellabelnewJLabel("职务");buttonnewJButton("全部");button12=newJButton("查询");ageBoxnewJComboBox();workAgeBox=newJComboBox();postionBox=newJComboBox();//初始化表格StringDBName=udyjavaworkspaceStoreHouseStoreHouGetDBInfogetInfo=newGetDBInfoDBNameselect*fromManager");rows=getInfo.getRows();smodel=newDefaultTableModel(rows,columnHeads);//用来修改表格值ewJTablemodeltablesetRowHeight//设置行高llPanetViewtablebleHeadersetReorderingAllowedfalse不可移动JPaneltablePanel=newJPanel(newtladdjspDBAccessdbnewDBAccess页脚内容 一、选择题bPathEstudyjavaworkspaceStoreHouseSrmentdbPathintb=0;postionBoxinsertItemAtrsgetStringbb++;}stmt.close();db.close();ptionexex.printStackTrace();}ageBoxinsertItemAt);ageBoxinsertItemAt);ageBoxinsertItemAt);ageBoxinsertItemAt);ageBoxinsertItemAt4);workAgeBox.insertItemAt("1~3",0);workAgeBoxinsertItemAt("4~7",1);workAgeBoxinsertItemAt("8~15",2);workAgeBoxinsertItemAt("16~20",3);workAgeBox.insertItemAt("20~",4);buttonsetBackgroundColor.cyan);buttonsetBackgroundColorcyan;/布局Boundslabel12.setBounds(140,5,100,30);ageBoxsetBounds180,5,80,30);label3.setBounds(280,5,100,30);workAgeBoxsetBounds(320,5,80,30);label14.setBounds(420,5,100,30);postionBoxsetBounds(460,5,80,30);button1.setBounds(580,5,80,30);button2.setBounds(680,5,80,30);tablePanelsetBounds(10,50,750,250);定要是面板panelsetLayoutnull);panel1.add(label11);panel1.add(label12);panel1.add(ageBox);panel1.add(label13);panel1.add(workAgeBox);paneladdlabel4);panel1.add(postionBox);paneladdbutton;paneladdbutton;panel1.add(tablePanel);面板TERBASELINETERBASELINEERBASELINEERBASELINEntntntnt仿仿仿仿label11.setForeground(Color.blue);buttonnewJButton("提交");newJTextFieldnewJTextFieldnewJTextFieldnewJTextFieldnewJTextFieldnewJTextFieldnewJTextFieldnewJTextFieldtextsetText");JLabellabelnewJLabel);ewJLabel页脚内容 一、选择题llllJLabellabelnewJLabel;ImageIconicon=newtudyjavaworkspaceStoreHousesetBoundstextsetBounds50,10,200,30);labelsetBounds0,50,100,30);textsetBounds50,50,200,30);labelsetBounds0,90,100,30);textsetBounds50,90,200,30);labelsetBounds,130,100,30);textsetBounds0,130,200,30);labelsetBounds0,170,100,30);textsetBounds0,170,200,30);labelsetBounds,210,100,30);textsetBounds0,210,200,30);labelsetBounds,250,100,30);textsetBounds0,250,200,30);labelsetBounds,10,420,180);textsetBounds380,210,400,30);buttonsetBounds50,250,250,30);panelsetLayoutnull;panel2.add(label21);panel2.add(text21);panel2.add(label22);panel2.add(text22);panel2.add(label23);panel2.add(text23);panel2.add(label24);panel2.add(text24);panel2.add(label25);panel2.add(text25);panel2.add(label26);panel2.add(text26);panel2.add(label27);panel2.add(text27);panel2.add(label28);panel2.add(text28);panel2.add(button21);ERBASELINEERBASELINEERBASELINEERBASELINETERBASELINEERBASELINEERBASELINEntntntntntntnt仿仿仿仿仿仿仿lignmentSwingConstants.CENTER);ackgroundColorlightGrayBackgroundColorlightGrayackgroundColorlightGrayackgroundColorlightGrayackgroundColorlightGrayackgroundColorlightGrayackgroundColorlightGrayetBackgroundColoryellowbuttonsetBackgroundColorblue;button21.setForeground(Color.red);面板newJTextFieldnewJTextFieldtext32.setText("数据宝贵,删除后无法找button31=newJButton("删除"); 一、选择题理员编号:");Font(Font("仿宋ERBASELINExtsetBackgroundColorcyansetBoundstextsetBounds350,50,300,50);buttonsetBounds0,150,100,50);textsetBounds,150,300,50);panel3.setLayout(null);panel3.add(label31);panel3.add(text31);panel3.add(text32);panel3.add(button31);布局ERBASELINEERBASELINETERBASELINE仿仿仿听器buttonaddActionListenerthisbuttonaddActionListenerthis;buttonaddActionListenerthisbuttonaddActionListenerthisackButtonaddActionListenerthiseBoxaddActionListenernewActionListener(){ionPerformedActionEvente==oxgetSelectedIndex";elseifindex{";dexstr1="between31and35";dexstr1="between36and40";ndexstr1=">40";}}});workAgeBoxaddActionListener(newActionListener(){ionPerformedActionEvente==workAgeBox.getSelectedIndex();str2="between1and3";dexstr2="between4and7";ifindex";eifindex";dex}}onBoxaddActionListenernewActionListener(){ionPerformedActionEvente 一、选择题JComboBoxsource=JComboBoxegetSource();str3=}ectn.setLayout(newBorderLayout());ctn.add(tabbedPane,BorderLayout.CENTER);kButtonBorderLayoutSOUTHframesetBounds,400);tVisibletrueframe.setResizable(false);DefaultCloseOperationJFrameDISPOSCLOSE}licvoidactionPerformedActionEvente按钮事件Objectsource=e.getSource();StringDBInfo=dyjavaworkspaceStoreHouseStoreHouGetDBInfoDB=newGetDBInfoDBInfoselectfromManager");rows=DB.getRows();model=newDefaultTableModel(rows,columnHeads);//用来修改表格值wJTablemodeliewtableeifsourcebuttonnull";null";null";StringDBInfo=udyjavaworkspaceStoreHouseStoreHouGetDBInfoDB=newGetDBInfoDBInfogetSQL;rows=DB.getRows();columnHeads=DB.getColumnHeads();model=newDefaultTableModel(rows,columnHeads);//用来修改表格值wJTablemodeljsp.setViewportView(table);ptionexkTrace}temoutprintlngetSQLifsourcebuttonDBAccessdbnewDBAccessdbPathEstudyjavaworkspaceStoreHouseSStringquerygetSQLementdbPathdb.executeUpdate(stmt,query);db.close();tsetTextclear2();ptionexkTrace}fsourcebuttonbooleandeleteStatefalse;DBAccessdbnewDBAccessdbPathEstudyjavaworkspaceStoreHouse\S页脚内容 一、选择题Managerwhere编号="+"'"+text31.getText()+ementdbPathetrsdbexecuteQuerystmtquery;ngequalstextgetText{query="delete;db.executeUpdate(stmt,query);tTextxtdeleteState=true;}}db.close();ptionexkTrace}setext32.setText("输入编号不存tText}cebackButtonframe.dispose();newSelect();}}ublicvoiddisposeedispose}publicvoidclear{tTexttTexttTexttTexttTexttTexttText}publicStringgetSQL{Stringtmp=null;tmp="select*fromManagerwhere"str2+"OR职务='"+str3+"'";returntmp;}publicStringgetSQL{ngtmpnullintoManager+"values"+"("+"'"+text21.getText()+"'"+","+"'"+text22.getText()+"'"+","+textgetText+"'"+text24.getText()+"'"+'"+","textgetText)+")";returntmp;}publicbooleanisExistStringstr){booleantmp=false;DBAccessdbnewDBAccessdbPathEstudyjavaworkspaceStoreHouseSStringquery="select姓名fromManagerInfo;mentdbPathResultSetrsdbexecuteQuerystmt 一、选择题getStringtoStringtmp=true;break;}}stmt.close();db.close();ptionexex.printStackTrace();}returntmp;}publicstaticvoidmainStringargs){ManagerInfotestnewManagerInfo();}}etentteFormatimportjava.util.Calendar;okenizermeelomboBoxPaneleonstantseAbstractTableModelefaultTableModelblicclassOutInimplementsActionListenerprivateJFrameframe;privateJRadioButtoninButton;ateJRadioButtonoutButtonprivateJButtonokButton;privateJButtonbackButton;privateJComboBoxcombox1;privateJComboBoxcombox2;privateJTabletable;privateVectorrows//表行值privateVectorcolumnHeads/表列名vateDefaultTableModelmodelprivateJScrollPanejsp;privateStringstr1=null,str2=null;privatebooleanflag=false;privateinttmp=0;privatestaticfinalStringYYYMMDDHHMMSS=publicOutIn(){frame=newJFrame("入库出库查询");inButton=newJRadioButton("入库查询outButton=newJRadioButton("出库查询okButtonnewJButton;onButtonGroupgroupnewButtonGroup();group.add(inButton);group.add(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论