![基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc_第1頁](http://file4.renrendoc.com/view/32c561b59d2e84ad3dd77efb25c1c589/32c561b59d2e84ad3dd77efb25c1c5891.gif)
![基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc_第2頁](http://file4.renrendoc.com/view/32c561b59d2e84ad3dd77efb25c1c589/32c561b59d2e84ad3dd77efb25c1c5892.gif)
![基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc_第3頁](http://file4.renrendoc.com/view/32c561b59d2e84ad3dd77efb25c1c589/32c561b59d2e84ad3dd77efb25c1c5893.gif)
![基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc_第4頁](http://file4.renrendoc.com/view/32c561b59d2e84ad3dd77efb25c1c589/32c561b59d2e84ad3dd77efb25c1c5894.gif)
![基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc_第5頁](http://file4.renrendoc.com/view/32c561b59d2e84ad3dd77efb25c1c589/32c561b59d2e84ad3dd77efb25c1c5895.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc文檔可直接使用可編輯,歡迎下載
基于JAVA學(xué)生信息管理系統(tǒng)【實(shí)用文檔】doc文檔可直接使用可編輯,歡迎下載成績(jī):成績(jī):江西科技師范大學(xué)畢業(yè)設(shè)計(jì)(論文)學(xué)生姓名:題目(中文):基于Java的學(xué)生信息管理系統(tǒng)(外文):StudentInformationManagementSystembasedonJava院(系):數(shù)學(xué)與計(jì)算機(jī)科學(xué)學(xué)院專業(yè):計(jì)算機(jī)科學(xué)與技術(shù)年級(jí):學(xué)號(hào):指導(dǎo)教師:時(shí)間:2016年4月2016年4月20日目錄TOC\o"1—3”\h\z\uHYPERLINK\l"_Toc448307081"1。引言PAGEREF_Toc448307081\h1HYPERLINK+kcm+"',’"? ?+xxkch+”')”; ?this.connDB();//連接數(shù)據(jù)庫 ??try{ ?? stmt。executeUpdat(yī)e(str); ?JOptionPane.showMessageDialog(null,this.getTitle()+"成功!",????? "提示",JOptionPane。INFORMATION_MESSAGE,newImageIcon( ?? ?"menu4.gif”)); ? ?this.setVisible(false); }?? catch(SQLExceptione){? ??JOptionPane。showMessageDialog(null,”課程號(hào)已存在?。ⅲ? ??tcno。setText(”"); ??}?}?publicvoidactionPerformed(ActionEvente){??if(e.getActionCommand()==”確定”){? ?this。insertst();?? if(isNewsm){ ? ?newCM(”課程信息管理")。display();? } isNewsm=true; ?}??if(e。getActionCommand()=="取消”){?? this.setVisible(false); newCM("課程信息管理").display(); } }}importjava。awt。Component;importjava.awt.FlowLayout;importjava.awt.event。*;importjava。sql.*;importjava.util。*;importjavax.swing。*;importjavax.swing.table.TableCellRenderer;classCMextendsJFrameimplementsActionListener{//課程信息管理?JPanelp=newJPanel();?JButtonbtnAdd=newJButton(”增加”);?JButtonbtnDelete=newJButton(”刪除”); JButtonbtnA(yù)lter=newJButton("修改”);?JButtonbtnSearch=newJButton("查詢”); JButtonbtnDisplay=newJButton(”顯示”); JMenuBarmb=newJMenuBar();?JPanelp1=newJPanel();;?JTablesTable;?JScrollPanescroll;?Connectioncon=null;?Statementstmt=null; ResultSetrs=null; Object[][]playerInfo;?CSelectcst; Stringmkch=null;?booleanbstd=false; CM(Stringtitle){//構(gòu)造方法??super(title); add(”South”,p); ?this.add("Center”,p1); mb。add(btnAdd); mb.add(btnDelete); ?mb。add(btnAlter); ?mb.add(btnSearch);??mb。add(btnDisplay);??this.connDB();//連接數(shù)據(jù)庫 this。setBounds(200,200,400,260);? btnAdd.addActionListener(this);??btnDelete.addActionListener(this);? btnAlter.addActionListener(this); ?btnSearch.addActionListener(this);??btnDisplay。addActionListener(this); this。setJMenuBar(mb);??//this。setDefaultCloseOperat(yī)ion(JFrame。EXIT_ON_CLOSE); ?this.setResizable(false); show();?} CM(CSelectcst,Stringtitle){//構(gòu)造方法 ?super(title);? this。cst=cst;??bstd=true; add("South",p);??this。add("Center",p1); ?mb。add(btnA(yù)dd);??mb.add(btnDelete); ?mb。add(btnAlter); ?mb.a(chǎn)dd(btnSearch); mb。add(btnDisplay);? this.connDB(); this.setBounds(200,200,400,260);??btnAdd.a(chǎn)ddActionListener(this); btnDelete.a(chǎn)ddActionListener(this);? btnA(yù)lter。addActionListener(this);??btnSearch.addActionListener(this);? btnDisplay.addActionListener(this); this。setJMenuBar(mb);? //this。setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?this。setResizable(false); ?show(); } publicvoiddisplay(){//顯示所有的課程信息 ?inti=0; intj=0;??intk=0; Listal=newArrayList();? try{ ??rs=stmt.executeQuery("select*fromc");? while(rs.next()){//找出表中的記錄數(shù)賦給i??? al.a(chǎn)dd(rs.getString("cno"));? ?al.add(rs。getString("cn")); ??al.a(chǎn)dd(rs.getString("pcno”)); ?? i++;???} ?}catch(SQLExceptione){?? e.printStackTrace();??}??playerInfo=newObject[i][3]; ?String[]columnNames={"課程號(hào)","課程名”,"先行課程號(hào)”};? try{ ??rs=stmt.executeQuery(”select*fromcorderbycno"); ??while(rs。next()){? playerInfo[j][0]=rs.getString("cno"); ?playerInfo[j][1]=rs.getString(”cn”);??? playerInfo[j][2]=rs.getString("pcno"); ???j++;???}? }catch(SQLExceptione){? e.printStackTrace();? } ?sTable=newJTable(playerInfo,columnNames);//創(chuàng)建網(wǎng)格? p1.add(sTable); scroll=newJScrollPane(sTable); this.a(chǎn)dd(scroll); } publicvoidconnDB(){//連接數(shù)據(jù)庫 try{?? Class.forName("com。microsoft.sqlserver。jdbc.SQLServerDriver”);? }catch(ClassNotFoundExceptione){? e。printStackTrace(); ?}? try{? con=DriverManager.getConnection(?? ??”jdbc:sqlserver://localhost:1433;DatabaseName=student", ?”sa","123"); ??stmt=con.createStatement(); }catch(SQLExceptione){ ?e.printStackTrace(); } }?publicvoidcloseDB()//關(guān)閉連接 {??try{ ? stmt.close(); ??con.close();??}catch(SQLExceptione){?? e.printStackTrace(); ?}?} publicvoiddelete(){//刪除某個(gè)課程信息 Stringkch=null;? Stringkcm=null;??Stringxxkch=null;? introw=-1; ?row=sTable.getSelectedRow();??if(row==—1){//判斷要?jiǎng)h除的信息是否被選中? JOptionPane。showMessageDialog(null,”請(qǐng)選擇要?jiǎng)h除的記錄!");? }else{? ?if(!bstd){//判斷選擇的是不是查詢后的結(jié)果 ???intj1=0;? ??try{ ?? rs=stmt。executeQuery(”select*fromc”); ? while(rs.next()&&j1〈=row){//找出當(dāng)前被選中的記錄在數(shù)據(jù)庫中的對(duì)應(yīng) ? kch=rs.getString(”cno");???? ?kcm=rs。getString("cn"); ? xxkch=rs。getString("pcno");?? ?? j1++;??? ?} ?}catch(SQLExceptione){? ? e.printStackTrace();??? } ? ?inti1=0;? try{ ????intrs1=stmt.executeUpdate("deletefromcwherecno='” ? +kch+"'");//刪除數(shù)據(jù)庫中當(dāng)前被選中的記錄??? JOptionPane.showMessageDialog(null,"記錄刪除成功!”);?? ?this.dispose();? ? newCM(”課程信息管理").display(); ? }catch(SQLExceptione){ ?e.printStackTrace(); ? ?}? ?}else{ ? ?try{ ?intrs1=stmt。executeUpdat(yī)e(”deletefromcwherecno='" ? ???+mkch+"'");//刪除數(shù)據(jù)庫中當(dāng)前被選中的記錄 ??JOptionPane.showMessageDialog(null,"記錄刪除成功!");?? this.dispose();? ?newCM("課程信息管理”).display();? ? }catch(SQLExceptione){?? ?e.printStackTrace(); }? ?}??}?}?publicvoidupdate(){//修改某個(gè)課程記錄 ?Stringkch=null;??Stringkcm=null;? Stringxxkch=null;??introw=-1; ?row=sTable.getSelectedRow(); if(row==-1){ ?JOptionPane。showMessageDialog(null,"請(qǐng)選擇要修改的記錄!”); ?}else{ ? intj1=0;? try{? if(!bstd){//判斷選擇的是不是查詢后的結(jié)果? ?? rs=stmt.executeQuery("select*fromc”); ?? }else{? ?rs=stmt.executeQuery("select*fromcwherecno='"+mkch?? ?+”'"); ? ?}?? ?while(rs。next()&&j1〈=row){//找出當(dāng)前被選中的記錄在數(shù)據(jù)庫中的對(duì)應(yīng) ??? kch=rs.getString(”cno"); ??kcm=rs。getString("cn");? ???xxkch=rs.getString("pcno"); ??? j1++;?? }? }catch(SQLExceptione){????e。printStackTrace();???}???CAddcadd=newCAdd();?? cadd。setTitle(”修改"); ??cadd.tcno.setText(kch); ?cadd.tcname。setText(kcm);? ?cadd。tpcno。setText(xxkch); ??cadd.tcno。setEnabled(false);? this.dispose();? }?} publicvoidselect(){//顯示某個(gè)查詢的結(jié)果??mkch=cst.kch;? playerInfo=newObject[1][3];? String[]columnNames={”課程號(hào)","課程名",”先行課程號(hào)"}; try{ ?rs=stmt。executeQuery(”select*fromcwherecno='”+mkch+”'”); ? while(rs.next()){ ? ?playerInfo[0][0]=rs.getString(”cno"); ?? playerInfo[0][1]=rs。getString("cn”); ???playerInfo[0][2]=rs.getString("pcno"); ??}??}catch(SQLExceptione){?? e.printStackTrace(); }??if(playerInfo[0][1]==null){?? this.dispose(); ?JOptionPane.showMessageDialog(null,”課程號(hào)不存在?。ⅲ?; ??newCM("課程信息管理").display();? }else{? sTable=newJTable(playerInfo,columnNames);//創(chuàng)建網(wǎng)格???p1.add(sTable);?? scroll=newJScrollPane(sTable);???this。add(scroll); ?} }?publicvoidactionPerformed(ActionEvente){ ?if(e.getActionCommand()==”增加”){ ?newCAdd();?? this。dispose(); } ?if(e。getActionCommand()=="刪除"){? this.delete();??} if(e。getActionCommand()=="修改"){ ?this。updat(yī)e();? } if(e.getActionCommand()=="查詢”){? cst=newCSelect(); ??this.dispose(); ?} ?if(e.getActionCommand()==”顯示”){???this。dispose(); ??newCM(”課程信息管理").display(); ?} }}importjava.awt。event。*;importjava.sql.Connection;importjava.sql。DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava。sql.Statement;importjavax.swing。*;publicclassCSelectextendsJFrameimplementsActionListener{//用于課程信息管理中查詢時(shí)輸入課程號(hào)的界面 JLabelltitle=newJLabel("課程號(hào):”); JTextFieldtcno=newJTextField(8); JButtonbtnOK=newJButton(”確定");?JPanelp=newJPanel(); Stringkch=null; publicCSelect(){//構(gòu)造方法 ?p.add(ltitle); p.add(tcno); ?p.add(btnOK);??add(p); this.setBounds(300,280,200,160); ?btnOK.addActionListener(this);??this。setResizable(false);??this。show(); }?publicvoidactionPerformed(ActionEvente){ ?kch=tcno.getText();//取得當(dāng)前輸入課程號(hào)的值 if(kch.equals("”)){//判斷是否輸入了課程號(hào) ? JOptionPane.showMessageDialog(null,”課程號(hào)不能為空,請(qǐng)重新輸入!”); }else{ ??this.dispose();?? newCM(this,”課程信息管理").select();? } }}importjavax。swing.*;importjava.awt。*;importjava。awt.event.*;importjava.sql。*;classDLFrameextendsJFrameimplementsActionListener,ItemListener{//登錄界面 JPanelp1=null; JPanelp2=null; JPanelp3=null;?JLabeluserName=newJLabel("用戶:"); JTextFieldtxtUser=newJTextField(); JLabelpassword=newJLabel("密碼:");?JPasswordFieldtxtPwd=newJPasswordField(6);?JLabelrole=newJLabel("角色:”);?JComboBoxcbrole=newJComboBox();?JButtonbtnLogin=newJButton("登錄”); JButtonbtncz=newJButton(”重置"); JButtonbtnCancel=newJButton(”取消"); JLabelimageLabel;?Iconimage; staticintOK=1;?stat(yī)icintCANCEL=0;?intactionCode=0;?Connectioncon=null; Statementstmt=null; ResultSetrs=null;?intqxian=0; publicDLFrame(){//構(gòu)造方法??super("登錄界面");? p1=newJPanel();? p2=newJPanel(); ?p3=newJPanel();? cbrole。addItem("管理員”);? cbrole.addItem(”學(xué)生”); image=newImageIcon(”picture\\st。jpg"); ?imageLabel=newJLabel(image);??p1。add(imageLabel); this.setLayout(newFlowLayout());??this.setBounds(100,100,246,345);? p2.setLayout(newGridLayout(4,2)); p2.a(chǎn)dd(userName);? p2。add(txtUser); ?p2。add(password);??p2。add(txtPwd); p2.add(role); ?p2.add(cbrole); ?p3。add(btnLogin); ?p3.add(btncz); p3.a(chǎn)dd(btnCancel); ?this。add(p1); this.add(p2); this.add(p3); ?this.setResizable(false);? this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?this。show();? btnLogin。addActionListener(this);??cbrole.a(chǎn)ddItemListener(this); btncz。addActionListener(this); ?btnCancel.a(chǎn)ddActionListener(this); } publicvoidconnDB(){//連接數(shù)據(jù)庫??try{ ? Class。forName(”com.microsoft.sqlserver。jdbc.SQLServerDriver");??}catch(ClassNotFoundExceptione){ ??e.prin
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025車輛抵債合同書
- 2025煉化工程建設(shè)總承包合同
- 2025油漆工程承包合同
- 2024-2025學(xué)年新教材高中語文 第七單元 16.2 登泰山記說課稿(1)部編版必修上冊(cè)
- 2024-2025學(xué)年高中地理 第1章 旅游和旅游資源 第2節(jié) 旅游資源的類型說課稿 中圖版選修3
- 二手房交易時(shí)合同范例
- 飲料公司組建方案
- 《 負(fù)數(shù)》(說課稿)-2023-2024學(xué)年六年級(jí)下冊(cè)數(shù)學(xué)人教版
- 石材礦山起料方案
- 鑄造企業(yè)整治方案制定
- 喬遷新居結(jié)婚典禮主持詞
- 小學(xué)四年級(jí)數(shù)學(xué)競(jìng)賽試題(附答案)
- 魯科版高中化學(xué)必修2全冊(cè)教案
- 建筑工程施工質(zhì)量驗(yàn)收規(guī)范檢驗(yàn)批填寫全套表格(浙江省)
- 《病理學(xué)基礎(chǔ)》知識(shí)考核試題題庫與答案
- 人口分布 高一地理下學(xué)期人教版 必修第二冊(cè)
- 部編版六年級(jí)下冊(cè)語文第3單元習(xí)作例文+習(xí)作PPT
- 四年級(jí)上冊(cè)英語試題-Module 9 Unit 1 What happened to your head--外研社(一起)(含答案)
- 子宮內(nèi)膜異位癥診療指南
- 《高級(jí)計(jì)量經(jīng)濟(jì)學(xué)》-上課講義課件
- 護(hù)理診斷及護(hù)理措施128條護(hù)理診斷護(hù)理措施
評(píng)論
0/150
提交評(píng)論