版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
PAGEII《Java程序設(shè)計(jì)》結(jié)課報(bào)告課程名稱JAVA程序設(shè)計(jì)設(shè)計(jì)題目同學(xué)信息管理系統(tǒng)專業(yè)班級(jí)信科101班學(xué)號(hào)09同學(xué)姓名XX教師彭潔信息工程系《Java程序設(shè)計(jì)》結(jié)課報(bào)告?目錄TOC\o"1-2"\h\uHYPERLINK\l"_Toc355627604"目錄?PAGEREF_Toc355627604\hIIHYPERLINK\l”_Toc355627605"第1章系統(tǒng)簡(jiǎn)介 PAGEREF_Toc355627605\h3HYPERLINK\l"_Toc355627606”1.1系統(tǒng)功能 PAGEREF_Toc355627606\h3HYPERLINK\l"_Toc355627607”1.2系統(tǒng)引用例子?PAGEREF_Toc355627607\h3HYPERLINK\l”_Toc355627608”第2章表的設(shè)計(jì)?PAGEREF_Toc355627608\h4HYPERLINK\l"_Toc355627609"2.1系統(tǒng)數(shù)據(jù)庫(kù)表結(jié)構(gòu)?PAGEREF_Toc355627609\h4HYPERLINK\l"_Toc355627610"第3章連接數(shù)據(jù)庫(kù)的實(shí)現(xiàn)?PAGEREF_Toc355627610\h5HYPERLINK\l”_Toc355627611"3.1SQLServer數(shù)據(jù)庫(kù)連接的關(guān)鍵代碼?PAGEREF_Toc355627611\h5HYPERLINK\l"_Toc355627612"第4章系統(tǒng)簡(jiǎn)略設(shè)計(jì)?PAGEREF_Toc355627612\h6HYPERLINK\l"_Toc355627613"4。1 系統(tǒng)登錄模塊設(shè)計(jì)?PAGEREF_Toc355627613\h6HYPERLINK\l”_Toc355627614"4。2系統(tǒng)主界面簡(jiǎn)略設(shè)計(jì) PAGEREF_Toc355627614\h9HYPERLINK4。3同學(xué)信息增刪改模塊設(shè)計(jì)?PAGEREF_Toc355627615\h10_Toc355627617”4.5注冊(cè)子管理員模塊設(shè)計(jì)?PAGEREF_Toc355627617\h15HYPERLINK第4章系統(tǒng)簡(jiǎn)略設(shè)計(jì) HYPERLINK\l"_Toc293570566”4。1 系統(tǒng)登錄模塊設(shè)計(jì)4。1.1、運(yùn)行效果圖圖4.1登錄主界面效果圖4.1.2、主要代碼publicclassloginextendsJDialog{stat(yī)icPreparedStatementSQL; privatestat(yī)icfinallongserialVersionUID=1L;privat(yī)eJLabell_Id=newJLabel(”登陸賬戶”,JLabel.CENTER);privateJLabell_pw=newJLabel("登陸密碼",JLabel。CENTER);privateJTextFieldt_Id=newJTextField(10);privateJPasswordFieldt_pw=newJPasswordField(10);privateJButtonbtnLogin;privat(yī)eJButtonbtnAdd;privateJButtonbtnClose;intnum=3;publiclogin(){super();Dimensionscree(cuò)nSize=Toolkit.getDefaultToolkit()。getScreenSize();this.setLocation((screenSize.width-300)/2,(screenSize.height-200)/2);this。setResizable(false);getContentPane().setBackground(newColor(225,225,225));getContentPane()。setLayout(null);initialize();}protectedvoidinitialize(){ setTitle("系統(tǒng)登錄”);?l_Id。setBounds(48,43,53,25); t_Id.setBounds(110,43,150,25); l_pw.setBounds(48,93,53,25);?t_pw。setBounds(110,93,150,25);?getContentPane().add(l_Id);?getContentPane()。add(l_pw);getContentPane().add(t_Id);getContentPane()。add(t_pw);btnLogin=newJButton();btnLogin。setText("登錄”);btnLogin.setBounds(20,142,85,28);btnLogin.setBackground(newColor(244,243,239)); ?btnLogin。addActionListener(newActionListener(){ publicvoidactionPerformed(ActionEvente){? ? ???addBtnLoginActionListener(); } }); getContentPane()。add(btnLogin);btnAdd=newJButton();btnAdd.setText("注冊(cè)”);btnAdd。setBounds(105,142,85,28);btnAdd。addActionListener(newActionListener(){??publicvoidactionPerformed(ActionEvente){??addNewzc=newaddNew();? setVisible(false);? zc.setVisible(true); }});getContentPane()。add(btnAdd);btnClose=newJButton();btnClose。setText(”關(guān)閉”);btnClose。setBounds(190,142,85,28);btnClose.addActionListener(newActionListener(){ ?publicvoidactionPerformed(ActionEvente){ ??dispose(); ??System.exit(-1); }});getContentPane()。add(btnClose);}privatevoidaddBtnLoginActionListener(){Stringid=t_Id.getText();Stringpassword=newString(t_pw.getPassword());if(id。equals(””)){ JOptionPane。showMessageDialog(this,"帳號(hào)不行為空","提示",?JOptionPane.WARNING_MESSAGE); return;}elseif(password.equals(”")){?JOptionPane.showMessageDialog(this,"密碼不行為空",”提示",?JOptionPane。WARNING_MESSAGE); return;}else{ toolst=newtools();?booleansuccess=false;//TODO:數(shù)據(jù)校驗(yàn)??success=t.eqes(id,password); if(success){//如果數(shù)據(jù)校驗(yàn)成功顯示主界面?? JOptionPane.showMessageDialog(this,"成功登錄”,”提示", ?JOptionPane.INFORMATION_MESSAGE); ?newmainView(); this.dispose();? }else{???--num; ?if(num==0){??? JOptionPane。showMessageDialog(this,”用戶名或者密碼錯(cuò)誤!您沒(méi)有機(jī)會(huì)了");? ? System。exit(0);? }else{? ?JOptionPane.showMessageDialog(this,"用戶名或者密碼錯(cuò)誤!您還有”+num+"次機(jī)會(huì)"); ?} ?}?}}publicDimensiongetPreferredSize(){returnnewDimension(320,170);}publicvoidshow(){Toolkittk=Toolkit。getDefaultToolkit();Dimensionscreen=tk.getScreenSize();Dimensiond=getSize();this.setLocation((screen.width—d.width)/2,(screen.height-d.height)/2); //輸入密碼后回車相當(dāng)于點(diǎn)擊了登錄按鈕 getRootPane().setDefaultButton(btnLogin);t_pw.requestFocus();setDefaultCloseOperation(DISPOSE_(tái)ON_CLOSE);?setSize(300,220); super.show();} publicstaticvoidmain(String[]args){DButilutil=newDButil();?util。getconn();?loginloginFrame=newlogin();loginFrame。setVisible(true);}}HYPERLINK\l"_Toc293570567"4。2 系統(tǒng)主界面簡(jiǎn)略設(shè)計(jì) 4。2。1、運(yùn)行效果圖圖4.2登錄后系統(tǒng)界面效果圖4。2.2、主要代碼publicmainView(){ super();??setTitle("全部同學(xué)信息");? setBounds(350,150,700,400); setDefaultCloseOperat(yī)ion(JFrame.EXIT_ON_CLOSE);? setVisible(true); finalJScrollPanescrollPane=newJScrollPane(); con=db.getconn(); ?VectortableValueV,columnNameV;//存放列名? columnNameV=newVector();??columnNameV.a(chǎn)dd(”學(xué)號(hào)"); columnNameV.a(chǎn)dd("名字");??columnNameV。add(”性別");??columnNameV.add("年齡"); ?tableValueV=newVector();scrollPane.setViewportView(table);? finalJPanelpanel=newJPanel(); getContentPane().add(panel,BorderLayout.SOUTH);??panel。add(newJLabel(”編號(hào):"));? aTextField=newJTextField(”",5);??panel。add(aTextField); ?panel.add(newJLabel(”姓名:")); ?bTextField=newJTextField("",5); ?panel。add(bTextField); ?panel。add(newJLabel(”性別:"));? cTextField=newJTextField("",5);? panel.add(cTextField); ?panel。add(newJLabel("年齡:"));? dTextField=newJTextField(””,5);?panel.a(chǎn)dd(dTextField);}HYPERLINK\l"_Toc293570568"4.3?同學(xué)信息增刪改模塊設(shè)計(jì) 4。3。1、增加信息(121,白娘子,M,22)后運(yùn)行效果圖如下:圖4.3增加一個(gè)記錄效果圖4。3.2、主要代碼finalJButtonaddButton=newJButton(”添加");addButton.addActionListener(newActionListener(){ publicvoidactionPerformed(ActionEvente){ userDaoadd=newuserDaoImpl(); useru=newuser();? u。setSno(Integer.parseInt(aTextField.getText())); u.setsName(bTextField.getText());??u.setSsex(cTextField.getText()); u。setSage(Integer.parseInt(dTextField.getText()));? add.addUser(u);??setVisible(false); ?newmainView();?}});panel.a(chǎn)dd(addButton);4.3.3、刪除信息編號(hào)為120的同學(xué)信息后結(jié)果如下:圖4.4刪除一個(gè)記錄效果圖4.3.4、主要代碼:?finalJButtondelButton=newJButton("刪除”); delButton.addActionListener(newActionListener(){??publicvoidactionPerformed(ActionEvente){? userDaodel=newuserDaoImpl();? ?userud=newuser();? ?intselectedRow=table。getSelectedRow();//獲得被選中行的索引? if(selectedRow?。健?)//推斷是否存在被選中行? del.deleUser(Integer.parseInt(aTextField。getText()));??? setVisible(false);?? tableModel.removeRow(selectedRow);? ?} });?panel。add(delButton);4。3.5、修改信息(105,關(guān)美眉,F,41)為(105,關(guān)大俠,M,30)后運(yùn)行效果圖如下:圖4.5修改一個(gè)記錄效果圖4.3。6、主要代碼:panel。add(searchButton);finalJButtonupdButton=newJButton("修改");updButton.a(chǎn)ddActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){userDaoupdate=newuserDaoImpl(); ?userupe=newuser(); ?aTextField.setEditable(false); intselectedRow=table.getSelectedRow();//獲得被選中行的索引 if(selectedRow!=-1){//推斷是否存在被選中行???upe。setSno(Integer。parseInt(aTextField。getText()));? upe.setsName(bTextField.getText());? ?upe。setSsex(cTextField。getText());? upe。setSage(Integer.parseInt(dTextField.getText())); ?updat(yī)e.updateUser(upe); ??setVisible(false); ?newmainView();? } }});panel。add(updButton);HYPERLINK\l”_Toc293570569"4.4同學(xué)信息查詢模塊設(shè)計(jì)?4.4.1、運(yùn)行效果圖圖4。6查詢記錄集效果圖查詢姓趙的人信息:圖4。7查詢結(jié)果圖查詢名字帶“山”的人信息:圖4。8查詢結(jié)果圖4.4。2、主要代碼:publicsearch(){?setTitle(”依據(jù)姓名查詢同學(xué)信息”); setLayout(newBorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); validat(yī)e();?setBounds(350,150,650,400);?finalJPanelpane=newJPanel(); jl=newJLabel("輸入姓或者名查詢");?TextField=newJTextField("",5);?jb1=newJButton("查詢");?jb2=newJButton(”返回"); pane。add(jl); pane.a(chǎn)dd(TextField); pane.add(jb1); pane.add(jb2); getContentPane().add(pane,BorderLayout.NORTH); jb1.addActionListener(this);?jb2.addActionListener(this); setVisible(true);}publicvoidactionPerformed(ActionEvente){?if(e.getActionCommand().equals(”查詢”)){??JScrollPanejsp=newJScrollPane(); ?VectortableValueV,columnNameV;??columnNameV=newVector(); ?columnNameV。add(”學(xué)號(hào)");??columnNameV.add(”名字"); ?columnNameV。add(”性別");? columnNameV.add("年齡"); ?tableValueV=newVector(); userDaouser=newuserDaoImpl();??useru=user.searchByName(TextField.getText());? VectorrowV=newVector();??rowV.add(u.getSno()); rowV.add(u。getsName());??rowV。add(u。getSsex());? rowV。add(u.getSage()); ?tableValueV.a(chǎn)dd(rowV); ?tableModel=newDefaultTableModel(tableValueV,columnNameV);??table=newJTable(tableModel);??jsp=newJScrollPane(table);? jsp.setViewportView(table); ?getContentPane()。add(jsp,BorderLayout.CENTER);??setVisible(true); }?if(e.getActionCommand().equals("返回")){??newmainView(); }}HYPERLINK\l”_Toc293570569”4.5注冊(cè)子管理員模塊設(shè)計(jì)?4.5。1、運(yùn)行效果圖圖4。9注冊(cè)子管理員效果圖4.5.2、主要代碼:publicaddNew(){ setDefaultCloseOperation(EXIT_ON_CLO(píng)SE);? load();? this.setVisible(true); ?Dimensionscree(cuò)nSize=Toolkit.getDefaultToolkit().getScreenSize();? this.setLocation((screenSize。width-300)/2, ? (screenSize。height-200)/2);??this.setResizable(false); ?this.setTitle("注冊(cè)子管理員界面”);??this.setVisible(true);? this.a(chǎn)ddWindowListener(newWindowAdapter(){ ??publicvoidwindowClosing(WindowEvente){? ? System。exit(0); }??});?} publicvoidload(){??Pane=(JPanel)getContentPane(); Pane.setLayout(null);??setSize(newDimension(410,300));? setTitle(”管理員登入界面”); t1。setBounds(70,50,100,30); ?t2.setBounds(70,80,100,30);? t3。setBounds(70,110,100,30); t4.setBounds(250,50,100,30);? t5。setBounds(250,80,100,30);??f1.setBounds(150,50,100,20);? f2。setBounds(150,80,100,20); ?f3。setBounds(150,110,100,20); b1。setFont(newjava.awt.Font(”Botton”,Font.BOLD,12)); ?b1。setBounds(120,140,60,50);??b2.setFont(newjava。awt。Font(”Dialog",Font.BOLD,12)); b2.setBounds(200,140,60,50);? Pane。add(t1);??Pane.a(chǎn)dd(t2); ?Pane.a(chǎn)dd(t3); ?Pane.add(t4);? Pane。add(t5); Pane.a(chǎn)dd(f1); ?Pane.add(f2); Pane。add(f3); ?Pane。add(b1);??Pane.a(chǎn)dd(b2); ?b1。addActionListener(this); b2.addActionListener(this); }4。5。3、當(dāng)注冊(cè)名已經(jīng)存在時(shí)效果如下:圖4.10驗(yàn)證注冊(cè)界面4。5.4、成功注冊(cè)時(shí)效果如下:(用戶名:qunqun;密碼:qunqun)圖4.11注冊(cè)成功界面4.5.5、主要代碼publicvoidactionPerformed(ActionEvente){ ?if(e.getActionCommand().equals("注冊(cè)”)){???if(tools.indes(f1.getText())&&tools.indes(f2.getText())){ ??if(tools.eqes(f1。getText(),f2.getText())){ ? JOptionPane.showMessageDialog(this,"該用戶已被注冊(cè),請(qǐng)重新輸入!"); ? ? System.exit(0); ? }else{ ?? ?tools。addUser(f1.getText(),f1。getText()); ?? JOptionPane.showMessageDialog(this,”你已經(jīng)成功注冊(cè)~");???? System。exit(0);? }?? } ??if(f1.getText()。equals("")||f2。getText()。equals(””)){ ? JOptionPane。showMessageDialog(this,"帳號(hào)或密碼長(zhǎng)度有誤”,"提示",?? ? JOptionPane.WARNING_MESSAGE); ??} ?}??if(e。getActionCommand().equals(”退出”)){ ??System.exit(0); ?}4.5.6、新注冊(cè)管理員(用戶名:qunqun;密碼:qunqun)登入效果如下:圖4.12登錄界面圖4。13登錄成功界面4.5.7、主要代碼:staticbooleaneqes(Stringadmin,Stringpasswd){ booleanbool=true;?try{ InputStreamis=newFileInputStream("1111。txt");??BufferedReaderreader=newBufferedReader(newInputStreamReader(is));? String
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 國(guó)防科學(xué)考試題目及答案
- 定做產(chǎn)品采購(gòu)合同范本
- 2026中國(guó)工商銀行招聘面試題及答案
- 南充產(chǎn)業(yè)發(fā)展集團(tuán)有限公司2025年招聘?jìng)淇碱}庫(kù)附答案
- 2026年憲法知識(shí)題庫(kù)附答案(完整版)
- 2026陜西旅游集團(tuán)招聘面試題及答案
- 2026年廊坊職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性考試必刷測(cè)試卷附答案解析
- 2025國(guó)家南極考察訓(xùn)練基地選調(diào)工作人員擬任職人員公示備考題庫(kù)附答案
- 2026年憲法知識(shí)題庫(kù)含完整答案(各地真題)
- 2026年科普知識(shí)題庫(kù)附答案(培優(yōu)b卷)
- DB11T 2491-2025 文物保護(hù)工程勘察規(guī)范 長(zhǎng)城
- 急性心肌梗死治療課件
- 樹(shù)木砍伐安全培訓(xùn)課件
- 風(fēng)電場(chǎng)冬季防火知識(shí)培訓(xùn)課件
- 中國(guó)郵政2025南通市秋招綜合管理職能類崗位面試模擬題及答案
- 源網(wǎng)荷儲(chǔ)一體化項(xiàng)目并網(wǎng)調(diào)試實(shí)施方案
- 2025-2030奶山羊養(yǎng)殖效益分析及乳制品深加工與產(chǎn)業(yè)投資機(jī)會(huì)報(bào)告
- 《〈京津冀建設(shè)工程計(jì)價(jià)依據(jù)-預(yù)算消耗量定額〉城市地下綜合管廊工程》第一冊(cè)土建工程
- 兒科護(hù)理課件模板
- UPS不間斷電源課件教學(xué)
- 2024年江蘇省鹽城市護(hù)理三基業(yè)務(wù)知識(shí)考試復(fù)習(xí)試卷及答案
評(píng)論
0/150
提交評(píng)論