物資管理系統(tǒng)樣本_第1頁(yè)
物資管理系統(tǒng)樣本_第2頁(yè)
物資管理系統(tǒng)樣本_第3頁(yè)
物資管理系統(tǒng)樣本_第4頁(yè)
物資管理系統(tǒng)樣本_第5頁(yè)
已閱讀5頁(yè),還剩54頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

《JAVA程序設(shè)計(jì)》課程設(shè)計(jì)報(bào)告 設(shè)計(jì)題目:物資管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn) 學(xué)院名稱:信息工程學(xué)院 專業(yè)班級(jí): 姓名: 學(xué)號(hào):13122102目錄目錄HYPERLINK +"'" +TCunfang.getText() +"','" +Tleibie.getText() +"'," +Tmingcheng.getText() +","+TOid.getText()+")"; SQLExceptions=null; System.out.print(query); try{ Modem=newMode(); System.out.print(query); s=m.zeng(query); System.out.print(s); JOptionPane.showMessageDialog(con,"增長(zhǎng)成功!"); }catch(Exceptions1){ JOptionPane.showMessageDialog(con,"增長(zhǎng)失敗!"); s1.printStackTrace(); } } if(e.getSource()==cho){ TCunfang.setText(""); Tleibie.setText(""); Tmingcheng.setText(""); TOid.setText(""); } } }}(2)顧客信息查詢和刪除基本屬性如下packagecn.GUI;publicclassdeleteadmextendsJFrame{ privateJTextAreatext; privateJTextAreatext1; privateJTextAreatext2; privateJTabletable; privateJComboBoxlist; privateJComboBoxlist1; privateJLabellable; privateJLabellable1; privateJLabellable2; privateJButtonsub; privateJButtonch; privateContainercon; privateStringnames[]={"員工號(hào)","姓名","查看所有顧客"};//下拉鏈表 privateConnectionconnection;//連接信息定義 privateStatementstatement; connectt=newconnect(); deleteadm(){ this.setSize(500,400); this.setLocationRelativeTo(null); this.setVisible(true); this.setLayout(newBorderLayout()); Containercon=this.getContentPane(); lable=newJLabel("選取:"); lable1=newJLabel("選取:"); lable2=newJLabel("員工號(hào):"); text=newJTextArea("",1,7); text1=newJTextArea("",1,7); text2=newJTextArea("",1,7); sub=newJButton("查詢"); ch=newJButton("刪除"); list=newJComboBox(names); list1=newJComboBox(names); list.setMaximumRowCount(3); list1.setMaximumRowCount(3); list.setSelectedIndex(0); list1.setSelectedIndex(0); //標(biāo)簽 JPanelsouth=newJPanel();//下面面板 JPanelTopPanel=newJPanel(); JPanelnorth=newJPanel(); north.setBounds(getBounds()); north.add(lable); north.add(list); north.add(text);//把按鈕添加到SePanel north.add(sub); south.add(lable2); south.add(text2); south.add(ch); table=newJTable();//表格 con.add(north,BorderLayout.NORTH); con.add(table,BorderLayout.CENTER); con.add(south,BorderLayout.SOUTH); //事件監(jiān)聽(tīng) BHandlerh=newBHandler(); sub.addActionListener(h); ch.addActionListener(h); } publicstaticvoidmain(Stringargs[]){ newdeleteadm(); } privatevoidgetTable(Stringtest){ //獲取表這一某些封裝在了一種類中 VectorgetV=newVector(); Vectorrows=newVector(); VectorcolumnHeads=newVector(); Stables=newStable(); getV=s.getable(test);//調(diào)用類里函數(shù) rows=(Vector)getV.get(0); columnHeads=(Vector)getV.get(1); //可以拆封 //在表格中顯示查詢成果 table=newJTable(rows,columnHeads);//傳入兩個(gè)對(duì)象public相稱與一種泛型數(shù)組 //JTable(TableModeldm, //TableColumnModelcm) JScrollPanescroller=newJScrollPane(table);//可滾動(dòng)面板 Containerc=getContentPane();//容器 c.remove(1); c.add(scroller,BorderLayout.CENTER); //刷新Table c.validate(); //**************************************** } publicclassBHandlerimplementsActionListener{ publicvoidactionPerformed(ActionEvente){ if(e.getSource()==sub){ repaint(); maplike=newmap(); Stringstr=like.ad().get(list.getSelectedItem()).toString(); Stringa=text.getText(); Stringtest; //Stringquery= //"select*fromadmwherename='"+a+"'andpass="+b;//拼接查詢語(yǔ)句 //到這里就剩余拼接字符串了 if(str=="Yid"){ test="select*fromadmwhere"+str+"="+a; }elseif(str=="*"){ test="select*fromadm"; } else{ test="select*fromadmwhere"+str+"='"+a+"'"; } //System.out.print(test); getTable(test); } if(e.getSource()==ch){ connection=t.sql();//封裝起來(lái)函數(shù) //deletefromwuliuwhereOid=6 Stringquery="deletefromadmwhereYid=" +text2.getText(); try{ Modem=newMode(); m.dele(query); JOptionPane.showMessageDialog(con,"刪除成功!"); }catch(Exceptione2){ JOptionPane.showMessageDialog(con,"刪除失敗!"); e2.printStackTrace(); } } } }}3.2.5物理信息查詢模塊(1)添加信息代碼如下:packagecn.GUI;publicclasszengjiaextendsJFrame{ privateJLabelbiaoti; privateJLabelYuanGongId; privateJLabelOid; privateJLabelCunfang; privateJLabelleibie; privateJLabelmingcheng; privateJTextFieldTYuanGongId; privateJTextFieldTOid; privateJTextFieldTCunfang; privateJTextFieldTleibie; privateJTextFieldTmingcheng; privateJButtonadd; privateJButtoncho; privateContainercon; zengjia(){ this.setSize(500,400); this.setLocationRelativeTo(null); this.setVisible(true); this.setLayout(newGridLayout(7,1)); biaoti=newJLabel("添加信息",JLabel.CENTER); biaoti.setFont(newFont("宋體",Font.BOLD,20)); YuanGongId=newJLabel("員工id:"); Cunfang=newJLabel("存儲(chǔ)者姓名:"); leibie=newJLabel("類別:"); mingcheng=newJLabel("物資名稱:"); Oid=newJLabel("運(yùn)單號(hào):"); TYuanGongId=newJTextField(10); TCunfang=newJTextField(10); Tleibie=newJTextField(10); Tmingcheng=newJTextField(10); TOid=newJTextField(10); add=newJButton("添加"); cho=newJButton("重填"); con=this.getContentPane(); JPanelp[]=newJPanel[7]; for(inti=0;i<7;i++){ p[i]=newJPanel(); con.add(p[i]); setVisible(true); } p[0].add(biaoti); p[1].add(Oid); p[1].add(TOid); p[2].add(YuanGongId); p[2].add(TYuanGongId); p[3].add(Cunfang); p[3].add(TCunfang); p[4].add(leibie); p[4].add(Tleibie); p[5].add(mingcheng); p[5].add(Tmingcheng); p[6].add(add); p[6].add(cho); BHandlerh=newBHandler();//添加事件監(jiān)聽(tīng) add.addActionListener(h); cho.addActionListener(h); } publicstaticvoidmain(Stringargs[]){ newzengjia(); } publicclassBHandlerimplementsActionListener{ @Override publicvoidactionPerformed(ActionEvente){ if(e.getSource()==add){ Stringquery="insertintowuliu(Oid,Bid,Oname,Olei,Os)values("+TOid.getText()+","+TYuanGongId.getText()+",'"+Tmingcheng.getText()+"','"+Tleibie.getText()+"','"+TCunfang.getText()+"')";//Sql語(yǔ)句 try{ Modem=newMode(); m.zeng(query); JOptionPane.showMessageDialog(con,"增長(zhǎng)成功!"); }catch(Exceptione1){ JOptionPane.showMessageDialog(con,"增長(zhǎng)失?。?); e1.printStackTrace(); } } if(e.getSource()==cho){ TCunfang.setText(""); Tleibie.setText(""); Tmingcheng.setText(""); TOid.setText(""); TYuanGongId.setText(""); } } } }(2)信息查看下面是它代碼:packagecn.GUI;publicclasssearchextendsJFrame{ //*************************************** privateJTextAreatext; privateJTabletable; privateJComboBoxlist; privateJLabellable; privateJButtonsub; privateStringnames[]={"員工號(hào)","運(yùn)單號(hào)","物品","種類","員工姓名","查詢所有"}; search(){ //******************************************************** this.setSize(500,400); this.setLocationRelativeTo(null); this.setVisible(true); Containercon=this.getContentPane();//創(chuàng)立container //遇到一種有趣問(wèn)題 lable=newJLabel("選取:"); text=newJTextArea(1,7);//ceishi sub=newJButton("查詢"); //事件監(jiān)聽(tīng) BHandlerh=newBHandler();//添加事件監(jiān)聽(tīng) sub.addActionListener(h); list=newJComboBox(names); list.setMaximumRowCount(3); list.setSelectedIndex(0); //標(biāo)簽 JPanelTopPanel=newJPanel(); JPanelSePanel=newJPanel(); TopPanel.setLayout(newBorderLayout()); TopPanel.add(SePanel); SePanel.setBounds(getBounds()); SePanel.add(lable); SePanel.add(list); SePanel.add(text);//把按鈕添加到SePanel SePanel.add(sub); table=newJTable();//表格 con.setLayout(newBorderLayout()); con.add(TopPanel,BorderLayout.NORTH); con.add(table,BorderLayout.CENTER); } publicstaticvoidmain(Stringargs[]){ newsearch(); } //**************************************************** privatevoidgetTable(Stringtest){ //獲取表這一某些封裝在了一種類中 VectorgetV=newVector(); Vectorrows=newVector(); VectorcolumnHeads=newVector(); Stables=newStable();// getV=s.getable(test);//調(diào)用類里函數(shù) rows=(Vector)getV.get(0); columnHeads=(Vector)getV.get(1); //可以拆封 //在表格中顯示查詢成果 table=newJTable(rows,columnHeads);//傳入兩個(gè)對(duì)象public相稱與一種泛型數(shù)組 //JTable(TableModeldm, //TableColumnModelcm) JScrollPanescroller=newJScrollPane(table);//可滾動(dòng)面板 Containerc=getContentPane();//容器 c.remove(1);//??? c.add(scroller,BorderLayout.CENTER); //刷新Table c.validate(); //**************************************** } //事件監(jiān)聽(tīng)類 publicclassBHandlerimplementsActionListener{ @Override publicvoidactionPerformed(ActionEvente){ //TODOAuto-generatedmethodstub if(e.getSource()==sub){ maplike=newmap(); Stringstr=like.ly().get(list.getSelectedItem()).toString(); Stringa=text.getText(); //System.out.print(str);測(cè)試專用 Stringtest; //Stringquery= //"select*fromadmwherename='"+a+"'andpass="+b;//拼接查詢語(yǔ)句 //到這里就剩余拼接字符串了 if(str=="Bid"||str=="Oid"){ test="select*fromwuliuwhere"+str+"="+a; }elseif(str=="*"){ test="select*fromwuliu"; }else{ test="select*fromwuliuwhere"+str+"='"+a+"'"; } //System.out.print(test); getTable(test); } } }}(3)信息修改信息修改分為學(xué)生基本信息修改,學(xué)生成績(jī)信息修改,由于原理相似就以修改學(xué)生基本信息作為例子進(jìn)行簡(jiǎn)介下面是她屬性信息代碼如下:packagecn.GUI;publicclassxiugaiextendsJFrame{ privateJTextAreatext; privateJTextAreatext1; privateJTextAreatext2; privateJTabletable; privateTableModeltm; privateJComboBoxlist; privateJComboBoxlist1; privateJLabellable; privateJLabellable1; privateJLabellable2; privateJButtonsub; privateJButtonch; privateStringnames[]={"員工號(hào)","運(yùn)單號(hào)","物品","種類","員工姓名"};//下拉鏈表 privateStringnames1[]={"員工號(hào)","物品","種類","員工姓名"};//下拉鏈表 Containercon=getContentPane(); xiugai(){ this.setSize(500,400); this.setLocationRelativeTo(null); this.setVisible(true); lable=newJLabel("選取:"); lable1=newJLabel("選取:"); lable2=newJLabel("運(yùn)單號(hào):"); text=newJTextArea("",1,7); text1=newJTextArea("",1,7); text2=newJTextArea("",1,7); sub=newJButton("查詢"); ch=newJButton("修改"); list=newJComboBox(names); list1=newJComboBox(names1); list.setMaximumRowCount(3); list1.setMaximumRowCount(3); list.setSelectedIndex(0); list1.setSelectedIndex(0); //標(biāo)簽 JPanelsouth=newJPanel(); JPanelTopPanel=newJPanel(); JPanelSePanel=newJPanel(); TopPanel.setLayout(newBorderLayout()); //TopPanel.add(newJScrollPane(text),BorderLayout.CENTER); TopPanel.add(SePanel); SePanel.setBounds(getBounds()); //SePanel.setBackground(Color.red); SePanel.add(lable); SePanel.add(list); SePanel.add(text);//把按鈕添加到SePanel SePanel.add(sub); south.add(lable2); south.add(text2); south.add(lable1); south.add(list1); south.add(text1);//把按鈕添加到SePanel south.add(ch); table=newJTable();//表格 //創(chuàng)立container con.setLayout(newBorderLayout()); con.add(TopPanel,BorderLayout.NORTH); con.add(table,BorderLayout.CENTER); con.add(south,BorderLayout.SOUTH); //事件監(jiān)聽(tīng) BHandlerh=newBHandler();//添加事件監(jiān)聽(tīng) sub.addActionListener(h); ch.addActionListener(h); } publicstaticvoidmain(String[]args){ newxiugai(); } privatevoidgetTable(Stringtest){ //獲取表這一某些封裝在了一種類中 VectorgetV=newVector(); Vectorrows=newVector(); VectorcolumnHeads=newVector(); Stables=newStable(); getV=s.getable(test);//調(diào)用類里函數(shù) rows=(Vector)getV.get(0); columnHeads=(Vector)getV.get(1); //可以拆封 //在表格中顯示查詢成果 table=newJTable(rows,columnHeads);//傳入兩個(gè)對(duì)象public相稱與一種泛型數(shù)組 //JTable(TableModeldm, //TableColumnModelcm) JScrollPanescroller=newJScrollPane(table);//可滾動(dòng)面板 Containerc=getContentPane();//容器 c.remove(1);//??? c.add(scroller,BorderLayout.CENTER); //刷新Table c.validate(); //**************************************** } publicclassBHandlerimplementsActionListener{ @Override publicvoidactionPerformed(ActionEvente){ //TODOAuto-generatedmethodstub maplike=newmap(); if(e.getSource()==sub){ //Stringa=(String)list.getSelectedItem(); Stringstr=like.ly().get(list.getSelectedItem()).toString(); Stringa=text.getText(); //System.out.print(str);測(cè)試專用 Stringtest; if(str=="Bid"||str=="Oid"){ test="select*fromwuliuwhere"+str+"="+a; }else{ test="select*fromwuliuwhere"+str+"='"+a+"'"; } //System.out.print(test); getTable(test); } if(e.getSource()==ch){ Stringstr=like.ly().get(list.getSelectedItem()).toString(); Stringtest1; if(str=="Bid"){ test1="updatewuliuset"+str+"="+text1.getText() +"whereOid="+text2.getText(); }else{ test1="updatewuliuset"+str+"='"+text1.getText() +"'whereOid="+text2.getText(); } try{ Modem=newMode(); m.zeng(test1); JOptionPane.showMessageDialog(con,"修改成功!"); }catch(Exceptione2){ JOptionPane.showMessageDialog(con,"修改失??!"); e2.printStackTrace(); } } } }}(4)刪除信息刪除學(xué)生信息代碼如下:packagecn.GUI;publicclassdeleteextendsJFrame{ privateJTextAreatext; privateJTextAreatext1; privateJTextAreatext2; privateJTabletable; privateJComboBoxlist; privateJComboBoxlist1; privateJLabellable; privateJLabellable1; privateJLabellable2; privateJButtonsub; privateJButtonch; privateContainercon; privateStringnames[]={"員工號(hào)","運(yùn)單號(hào)","物品","種類","員工姓名"};//下拉鏈表 privateConnectionconnection;//連接信息定義 privateStatementstatement; connectt=newconnect(); delete(){ this.setSize(500,400); this.setLocationRelativeTo(null); this.setVisible(true); this.setLayout(newBorderLayout()); Containercon=this.getContentPane(); lable=newJLabel("選取:"); lable1=newJLabel("選取:"); lable2=newJLabel("運(yùn)單號(hào):"); text=newJTextArea("",1,7); text1=newJTextArea("",1,7); text2=newJTextArea("",1,7); sub=newJButton("查詢"); ch=newJButton("刪除"); list=newJComboBox(names); list1=newJComboBox(names); list.setMaximumRowCount(3); list1.setMaximumRowCount(3); list.setSelectedIndex(0); list1.setSelectedIndex(0); //標(biāo)簽 JPanelsouth=newJPanel();//下面面板 JPanelTopPanel=newJPanel(); JPanelnorth=newJPanel(); north.setBounds(getBounds()); north.add(lable); north.add(list); north.add(text);//把按鈕添加到SePanel north.add(sub); south.add(lable2); south.add(text2); south.add(ch); table=newJTable();//表格 con.add(north,BorderLayout.NORTH); con.add(table,BorderLayout.CENTER); con.add(south,BorderLayout.SOUTH); //事件監(jiān)聽(tīng) BHandlerh=newBHandler(); sub.addActionListener(h); ch.addActionListener(h); } publicstaticvoidmain(Stringargs[]){ newdelete(); } privatevoidgetTable(Stringtest){ //獲取表這一某些封裝在了一種類中 VectorgetV=newVector(); Vectorrows=newVector(); VectorcolumnHeads=newVector(); Stables=newStable(); getV=s.getable(test);//調(diào)用類里函數(shù) rows=(Vector)getV.get(0); columnHeads=(Vector)getV.get(1); //可以拆封 //在表格中顯示查詢成果 table=newJTable(rows,columnHeads);//傳入兩個(gè)對(duì)象public相稱與一種泛型數(shù)組 //JTable(TableModeldm, //TableColumnModelcm) JScrollPanescroller=newJScrollPane(table);//可滾動(dòng)面板 Containerc=getContentPane();//容器 c.remove(1); c.add(scroller,BorderLayout.CENTER); //刷新Table c.validate(); //**************************************** } publicclassBHandlerimplementsActionListener{ publicvoidactionPerformed(ActionEvente){ if(e.getSource()==sub){ repaint(); maplike=newmap(); Stringstr=like.ly().get(list.getSelectedItem()).toString(); Stringa=text.getText(); Stringtest; //Stringquery= //"select*fromadmwherename='"+a+"'andpass="+b;//拼接查詢語(yǔ)句 //到這里就剩余拼接字符串了 if(str=="Bid"||str=="Oid"){ test="select*fromwuliuwhere"+str+"="+a; }else{ test="select*fromwuliuwhere"+str+"='"+a+"'"; } //System.out.print(test); getTable(test); } if(e.getSource()==ch){ connection=t.sql();//封裝起來(lái)函數(shù) //deletefromwuliuwhereOid=6 Stringquery="deletefromwuliuwhereOid=" +text2.getText(); try{ Modem=newMode(); m.dele(query); JOptionPane.showMessageDialog(con,"刪除成功!"); }catch(Exceptione2){ JOptionPane.showMessageDialog(con,"刪除失??!"); e2.printStackTrace(); } } } }}3.2.5系統(tǒng)管理模塊3.2.6主窗體菜單設(shè)計(jì)packagecn.GUI;publicclasszhuextendsJFrame{ JMenuBarbar=newJMenuBar(); JMenumenu=newJMenu("管理信息"); JMenuguan=newJMenu("管理員管理"); JMenuItemg1=newJMenuItem("注冊(cè)"); JMenuItemg2=newJMenuItem("刪除"); JMenubang=newJMenu("協(xié)助"); JMenuItemm1=newJMenuItem("查詢"); JMenuItemm2=newJMenuItem("添加"); JMenuItemm3=newJMenuItem("修改"); JMenuItemm4=newJMenuItem("刪除"); JLabelim; privateContainercon; privateJButtonjButton1; ImageIconbg=newImageIcon("001.jpg"); JLabellable=newJLabel(bg); zhu(){ this.setTitle("主窗口"); this.setVisible(true); this.setSize(600,500); this.setLocationRelativeTo(null); im=newJLabel(newImageIcon("001.jpg")); //添加圖片 bar.setOpaque(true); setJMenuBar(bar); guan.add(g1); guan.add(g2);

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論