4.支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計-數(shù)據(jù)庫大作業(yè)_第1頁
4.支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計-數(shù)據(jù)庫大作業(yè)_第2頁
4.支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計-數(shù)據(jù)庫大作業(yè)_第3頁
4.支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計-數(shù)據(jù)庫大作業(yè)_第4頁
4.支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計-數(shù)據(jù)庫大作業(yè)_第5頁
已閱讀5頁,還剩21頁未讀, 繼續(xù)免費閱讀

付費下載

下載本文檔

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

文檔簡介

數(shù)據(jù)庫原理課程設(shè)計題目:支持校園卡的食堂消費信息管理系統(tǒng)專業(yè):計算機科學(xué)與技術(shù)班級:學(xué)生:教師:日期:2014年06月18日支持校園卡的食堂消費信息管理系統(tǒng)數(shù)據(jù)庫設(shè)計一.需求分析階段1.引言通過對本校區(qū)學(xué)生日常生活的實地調(diào)查以及自己的親身體驗,了解到現(xiàn)在許多高校學(xué)生生活消費仍然停留在多種消費分塊進(jìn)行,相對獨立的模式。開發(fā)出合適的學(xué)生消費管理系統(tǒng),可以有利于提高高校消費管理的工作效率。2.目標(biāo)與任務(wù)(1)需求分析階段的目標(biāo):1.了解目前高校的學(xué)生消費管理現(xiàn)狀2.通過平時的觀察、思考和親身體會,加上重點實地調(diào)查和記錄的方式了解和收集大部分學(xué)生所需要的消費管理的工作流程,確定系統(tǒng)的基本開發(fā)方向。3.與小組成員討論個人想法,共同制定開發(fā)方案4.與指導(dǎo)老師交流小組的想法,征求意見,改正不合理的地方,確定新系統(tǒng)的邊界,為下面的概念設(shè)計與邏輯設(shè)計奠定基礎(chǔ)。3.需求分析階段的任務(wù)(1)處理對象:系統(tǒng)要處理的對象包括:學(xué)生基本信息,發(fā)卡部門的基本信息,財務(wù)部門的基本信息,校園卡的基本信息,食堂消費的基本信息,各個對象包括信息如下所示(詳細(xì)的數(shù)據(jù)見于數(shù)據(jù)字典)學(xué)生的基本信息(Student):包括學(xué)生姓名,學(xué)生學(xué)號,身份證號,學(xué)生性別,學(xué)生所在院系,學(xué)生所在專業(yè)等方面的信息校園卡的基本信息:包括持卡人的學(xué)生學(xué)號,持卡人的身份證號,持卡人的所在院系,校園卡的狀態(tài),校園卡內(nèi)的余額食堂消費基本信息:包括消費(HConsume)金額等基本信息財務(wù)部門基本信息:包括辦公室基本信息校園卡日常事務(wù)管理基本信息:包括辦卡部門基本信息,辦卡信息(FStudentAdd),掛失信息(FLostInf),充值信息(DRecharge)每個數(shù)據(jù)結(jié)構(gòu)中的數(shù)據(jù)項見數(shù)據(jù)字典(2)處理功能要求:系統(tǒng)主要完成以下幾個功能:1.學(xué)生基本信息的信息查詢與更新2.校園卡日常事務(wù)管理情況基本信息查詢與更新3.校園卡狀態(tài)的查詢4.學(xué)生在食堂的消費金額的查詢5.食堂營業(yè)額的基本信息的查詢和修改,查詢所有食堂的營業(yè)額以體現(xiàn)食堂總體的收入狀況,查詢各個食堂的收入為評價食堂的服務(wù)質(zhì)量提供依據(jù)(3)安全性和完整性要求安全性是通過視圖機制,不同的用戶只能訪問系統(tǒng)授權(quán)的視圖,這樣可提供系統(tǒng)數(shù)據(jù)一定程度上的安全性,再通過用戶授權(quán)機制,用用戶登錄方式來識別用戶級別,根據(jù)這個級別來分配用戶權(quán)限,達(dá)到數(shù)據(jù)更高層次的安全保密功能。完整性要求用于描述學(xué)生的基本信息,財務(wù)部門的基本信息,校園卡日常事務(wù)管理的基本信息,校園卡基本信息,食堂消費基本信息中數(shù)據(jù)項能否為null,以及一些用戶自定義完整性(符合實際要求),此處用于觸發(fā)器實現(xiàn),詳細(xì)完整性要求見于系統(tǒng)的邏輯設(shè)計階段和數(shù)據(jù)庫實施階段。二、概念結(jié)構(gòu)設(shè)計階段nm11持有充值nmmn11財務(wù)部門消費食堂刷卡機發(fā)卡部門包含掛補校園卡學(xué)生1.E-R圖:nm11持有充值nmmn11財務(wù)部門消費食堂刷卡機發(fā)卡部門包含掛補校園卡學(xué)生學(xué)生食堂消費學(xué)生食堂消費2.數(shù)據(jù)字典:編號數(shù)據(jù)項名稱簡述類型及寬度取值范圍DI-1Studentid學(xué)生身份證號Char(18)0-999999999999999999DI-2Studentno學(xué)生學(xué)號Char(9)0-999999999DI-3Studentna學(xué)生姓名Char(10)DI-4Studentsex學(xué)生性別Char(4)“男”“女”DI-5Studentbirth學(xué)生出生年IntDI-6Studentdept學(xué)生所在院系Char(20)DI-7Studentspecial學(xué)生所在專業(yè)Char(20)DI-8Studentclass學(xué)生所在班級Char(20)DI-9Cardstate校園卡狀態(tài)“掛失”“未掛失”DI-10Cardmoney校園卡余額FloatDI-11CZmoney充值金額FloatDI-12Dinmoney食堂刷卡金額Float3.數(shù)據(jù)結(jié)構(gòu):數(shù)據(jù)結(jié)構(gòu)編號數(shù)據(jù)結(jié)構(gòu)名稱數(shù)據(jù)結(jié)構(gòu)別名數(shù)據(jù)結(jié)構(gòu)含義數(shù)據(jù)項組成Ds-1學(xué)生信息Student記錄學(xué)生的信息Studentid,Studentno,Studentna,Studentsex,Studentdept,StudentspecialDs-2辦卡信息FStudentAdd記錄辦卡信息Studentno,StudentidDs-3掛失信息FloseInf記錄掛失信息Studentno,StudentidDs-4解掛信息FUnlose記錄解掛信息Studentno,StudentidDs-5充值信息DRecharge記錄充值信息Studentno,CZmoneyDs-6校園卡信息StudentEdit記錄校園卡信息Studentno,Studentid,Cardstates,CardmoneyDs-7食堂刷卡信息Hconsume記錄食堂刷卡信息Consumemoney4.數(shù)據(jù)流:編號數(shù)據(jù)流名稱輸入信息輸出信息1查詢學(xué)生信息學(xué)號學(xué)生基本信息2修改學(xué)生信息變更信息學(xué)生基本信息3查詢校園卡信息校園卡號校園卡基本信息4修改校園卡信息變更信息校園卡基本信息5查詢食堂消費信息校園卡號食堂消費基本信息6修改食堂消費信息變更信息食堂消費基本信息5.數(shù)據(jù)存儲:數(shù)據(jù)存儲名輸入數(shù)據(jù)流輸出數(shù)據(jù)流學(xué)生信息表修改學(xué)生信息記錄學(xué)生信息校園卡信息表修改校園卡信息記錄校園卡信息食堂信息表修改食堂信息記錄食堂信息處理過程:處理過程名輸入數(shù)據(jù)流輸出數(shù)據(jù)流數(shù)據(jù)維護(hù)各數(shù)據(jù)表的更新、修改信息更新及修改后的各信息表注冊學(xué)生信息學(xué)生基本信息學(xué)生基本信息注冊校園卡信息校園卡基本信息校園卡基本信息三、邏輯結(jié)構(gòu)設(shè)計階段:1.將E-R圖轉(zhuǎn)化為關(guān)系模型通過分析所要實現(xiàn)的功能以及現(xiàn)有的實體和聯(lián)系,確定要把學(xué)生實體,校園卡實體,食堂實體分別轉(zhuǎn)化為單獨的關(guān)系模式,為了便于查詢學(xué)生在食堂刷卡消費信息,學(xué)生的校園卡信息管理,把消費型刷卡關(guān)系轉(zhuǎn)化為獨立的關(guān)系模式,考慮到學(xué)生要往校園卡里充值,再從學(xué)生和校園卡的擁有關(guān)系中抽取出校園卡的充值關(guān)系模式。具體關(guān)系模式轉(zhuǎn)化結(jié)果如下:學(xué)生:Student(Studentid,Studentno,Studentna,Studentsex,Studentdept,Studentspecial)校園卡:Card(Cardno,Studentno,Studentid,Cardstate,Cardmoney)充值信息:DRecharge(Studentno,Czmoney)消費刷卡:Hconsume(Consumemoney)2.系統(tǒng)功能模塊圖:食堂消費管理系統(tǒng)校園卡充值退出用戶登錄學(xué)生信息管理食堂刷卡機發(fā)卡部門財務(wù)部門系統(tǒng)管理食堂消費管理系統(tǒng)校園卡充值退出用戶登錄學(xué)生信息管理食堂刷卡機發(fā)卡部門財務(wù)部門系統(tǒng)管理消費掛失與消費掛失與解掛校園卡辦理四、數(shù)據(jù)庫的物理設(shè)計階段1.物理設(shè)計階段的目標(biāo)和任務(wù)數(shù)據(jù)庫的物理設(shè)計就是根據(jù)所用的DBMS和處理需求,進(jìn)行物理存儲安排,建立索引,形成數(shù)據(jù)庫的內(nèi)模式,為邏輯數(shù)據(jù)模型選取一個最適合應(yīng)用要求的物理結(jié)構(gòu)的過程,在這個階段中要完成兩大任務(wù):確定數(shù)據(jù)庫的物理結(jié)構(gòu),在關(guān)系數(shù)據(jù)庫中主要是存取方法和存儲結(jié)構(gòu)對物理結(jié)構(gòu)進(jìn)行評價,評價的重點是時間和空間效率。2.數(shù)據(jù)存儲方面為數(shù)據(jù)庫中各基本表建立的索引如下:由于進(jìn)本表Card,Student的主碼Cardno,Studentno經(jīng)常在查詢條件和連接操作的連接條件中出現(xiàn),且他們的取值唯一,考慮在這兩個屬性上分別建立唯一性索引;有的基本表中的屬性經(jīng)常性的發(fā)生變化,索引并不是越多越好,而要權(quán)衡系統(tǒng)為維護(hù)索引付出的代價,因此在其他的表上可考慮不建立索引,也可以適當(dāng)?shù)慕⑺饕?。五、?shù)據(jù)庫實施階段1.程序編碼部分源代碼:Controller-Mainwindow/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packagecontroller;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importview.DRecharge;importview.FLoseInf;importview.SLogin;importview.FStudentAdd;importview.FUnLose;importview.HConsume;importview.SInformation;/****@authorcomputer*/publicclassMainWindowextendsJFrameimplementsActionListener{JMenuBarmenuBar;JMenumenu1,menu2,menu3,menu4;JMenuItemm11,m12,m13;JMenuItemm21;JMenuItemm31,m32,m33,m34;JMenuItemm41;publicMainWindow(){createMenu();setTitle("支持校園卡的食堂信息管理系統(tǒng)");setIconImage((newImageIcon("icon.gif")).getImage());setSize(800,600);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setVisible(true);}privatevoidcreateMenu(){menuBar=newJMenuBar();menu1=newJMenu("系統(tǒng)管理(S)");menu1.setMnemonic('S');m11=newJMenuItem("學(xué)生信息查詢");m12=newJMenuItem("用戶登錄");m13=newJMenuItem("退出(X)");m13.setAccelerator(KeyStroke.getKeyStroke('X',2));menu1.add(m11);menu1.add(m12);menu1.addSeparator();menu1.add(m13);menu2=newJMenu("財務(wù)部門(D)");menu2.setMnemonic('D');m21=newJMenuItem("校園卡充值");menu2.add(m21);menu3=newJMenu("發(fā)卡部門(F)");menu3.setMnemonic('F');m31=newJMenuItem("校園卡掛失");m32=newJMenuItem("校園卡解卦");m33=newJMenuItem("補辦校園卡");m34=newJMenuItem("辦理校園卡");menu3.add(m31);menu3.add(m32);menu3.add(m33);menu3.add(m34);menu4=newJMenu("食堂刷卡機(H)");menu4.setMnemonic('H');m41=newJMenuItem("消費");menu4.add(m41);m11.addActionListener(this);m12.addActionListener(this);m13.addActionListener(this);m21.addActionListener(this);m31.addActionListener(this);m32.addActionListener(this);m33.addActionListener(this);m34.addActionListener(this);m41.addActionListener(this);menuBar.add(menu1);menuBar.add(menu2);menuBar.add(menu3);menuBar.add(menu4);this.setJMenuBar(menuBar);}@OverridepublicvoidactionPerformed(ActionEvente){if(e.getSource()==m34){newFStudentAdd();}if(e.getSource()==m12){newSLogin();}if(e.getSource()==m21){newDRecharge();}if(e.getSource()==m31){newFLoseInf();}if(e.getSource()==m32){newFUnLose();}if(e.getSource()==m41){newHConsume();}if(e.getSource()==m11){newSInformation();}}//publicstaticvoidmain(Stringargs[]){//newMainWindow();//}}Controller-Start/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packagecontroller;importjava.awt.event.ActionEvent;importjavax.swing.JFrame;/****@authorcomputer*/publicclassStart{publicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(Stringargs[]){JFrame.setDefaultLookAndFeelDecorated(true);newMainWindow();}}Dao-ConnectDB/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packagedao;importjava.sql.Connection;importjava.sql.DriverManager;/****@authorcomputer*/publicclassConnectDB{publicstaticConnectionconnect(){try{Class.forName("com.mysql.jdbc.Driver");//加載驅(qū)動程序Connectioncon=DriverManager.getConnection("jdbc:mysql://localhost:3306/school?useUnicode=true&characterEncoding=utf8","root","123456");//連接數(shù)據(jù)庫returncon;//返回連接對象}catch(Exceptione){e.printStackTrace();returnnull;}}}Dao-FStudentDao/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packagedao;importidao.IFStudentDao;importjava.sql.Connection;importjava.sql.PreparedStatement;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.util.ArrayList;importjava.util.List;importmodel.FStudent;/****@authorcomputer*/publicclassFStudentDaoimplementsIFStudentDao{publicbooleanaddFStudent(FStudentfStudent){Connectioncon=null;//連接對象PreparedStatementps=null;//SQL預(yù)處理類接口,能大大提高系統(tǒng)效率try{con=ConnectDB.connect();//連接數(shù)據(jù)庫Stringsql="insertintostudent(StudentId,StudentDe,StudentNa,StudentSex,StudentPo,StudentNo)values(?,?,?,?,?,?)";ps=con.prepareStatement(sql);ps.setString(1,fStudent.getStudentId());ps.setString(2,fStudent.getStudentDe());ps.setString(3,fStudent.getStudentNa());ps.setString(4,fStudent.getStudentSex());ps.setString(5,fStudent.getStudentPo());ps.setString(6,fStudent.getStudentNo());intn=ps.executeUpdate();returnn>0;}catch(SQLExceptione){e.printStackTrace();returnfalse;}finally{try{ps.close();}catch(SQLExceptionex){}}}@OverridepublicbooleaneditFStudent(FStudentfStudent){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}@OverridepublicbooleandeleteFStudent(intfStudentId){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}@OverridepublicFStudentfintFStudent(intfStudentId){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}@OverridepublicList<FStudent>fintAllFStudents(){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}@OverridepublicList<FStudent>fintSomeFStudents(StringfStudentName,intpageNo,intpageSize){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}@OverridepublicintfintCount(StringfStudentName){thrownewUnsupportedOperationException("Notsupportedyet.");//Tochangebodyofgeneratedmethods,chooseTools|Templates.}}Idao-IFstudentDao/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageidao;importjava.util.List;importmodel.FStudent;/****@authorcomputer*/publicinterfaceIFStudentDao{booleanaddFStudent(FStudentfStudent);booleaneditFStudent(FStudentfStudent);booleandeleteFStudent(intfStudentId);FStudentfintFStudent(intfStudentId);List<FStudent>fintAllFStudents();List<FStudent>fintSomeFStudents(StringfStudentName,intpageNo,intpageSize);intfintCount(StringfStudentName);}Model-FStudent/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packagemodel;/****@authorcomputer*/publicclassFStudent{privateStringStudentId;privateStringStudentDe;privateStringStudentNa;privateStringStudentSex;privateStringStudentPo;privateStringStudentNo;publicStringgetStudentId(){returnStudentId;}publicvoidsetStudentId(StringStudentId){this.StudentId=StudentId;}publicStringgetStudentDe(){returnStudentDe;}publicvoidsetStudentDe(StringStudentDe){this.StudentDe=StudentDe;}publicStringgetStudentNa(){returnStudentNa;}publicvoidsetStudentNa(StringStudentNa){this.StudentNa=StudentNa;}publicStringgetStudentSex(){returnStudentSex;}publicvoidsetStudentSex(StringStudentSex){this.StudentSex=StudentSex;}publicStringgetStudentPo(){returnStudentPo;}publicvoidsetStudentPo(StringStudentPo){this.StudentPo=StudentPo;}publicStringgetStudentNo(){returnStudentNo;}publicvoidsetStudentNo(StringStudentNo){this.StudentNo=StudentNo;}}View-DRecharge/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageview;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;/****@authorcomputer*/publicclassDRechargeextendsJFrameimplementsActionListener{Stringtitle[]={"學(xué)號","姓名","充值金額",};JTextFieldtxtNo=newJTextField(5);JTextFieldtxtName=newJTextField(10);JTextFieldtxtCZmoney=newJTextField(5);JButtonbtnOK=newJButton("保存");JButtonbtnCancel=newJButton("取消");publicDRecharge(){Containercon=getContentPane();con.setLayout(newGridLayout(4,1));JPanelp[]=newJPanel[3];for(inti=0;i<3;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtNo);p[1].add(txtName);p[2].add(txtCZmoney);for(inti=0;i<3;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);con.add(bottom);btnOK.addActionListener(this);btnCancel.addActionListener(this);setTitle("校園卡充值窗口");setSize(300,270);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==btnOK){//newMainWindow;}else{dispose();}}publicstaticvoidmain(String[]args){JFrame.setDefaultLookAndFeelDecorated(true);newDRecharge();}}View-LoseInf/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageview;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;/****@authorcomputer*/publicclassFLoseInfextendsJFrameimplementsActionListener{Stringtitle[]={"學(xué)號","姓名","院系"};JTextFieldtxtNo=newJTextField(5);JTextFieldtxtName=newJTextField(10);JTextFieldtxtDpartment=newJTextField(10);JButtonbtnOK=newJButton("掛失");JButtonbtnCancel=newJButton("取消");publicFLoseInf(){Containercon=getContentPane();con.setLayout(newGridLayout(4,1));JPanelp[]=newJPanel[3];for(inti=0;i<3;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtNo);p[1].add(txtName);p[2].add(txtDpartment);for(inti=0;i<3;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);con.add(bottom);btnOK.addActionListener(this);btnCancel.addActionListener(this);setTitle("校園卡掛失窗口");setSize(300,270);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==btnOK){//newMainWindow;}else{dispose();}}publicstaticvoidmain(String[]args){JFrame.setDefaultLookAndFeelDecorated(true);newFLoseInf();}}View-FStudentAdd/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageview;importdao.FStudentDao;importidao.IFStudentDao;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importmodel.FStudent;/****@authorcomputer*/publicclassFStudentAddextendsJFrameimplementsActionListener{Stringtitle[]={"學(xué)號","院系","姓名","性別","專業(yè)","身份證號"};JTextFieldtxtNo=newJTextField(10);JTextFieldtxtDpartment=newJTextField(10);JTextFieldtxtName=newJTextField(10);JRadioButtonradSexM=newJRadioButton("男");JRadioButtonradSexF=newJRadioButton("女");JTextFieldtxtSpecial=newJTextField(10);JTextFieldtxtID=newJTextField(15);JButtonbtnOK=newJButton("保存");JButtonbtnCancel=newJButton("取消");publicFStudentAdd(){ButtonGroupgroup=newButtonGroup();group.add(radSexM);group.add(radSexF);Containercon=getContentPane();con.setLayout(newGridLayout(7,1));JPanelp[]=newJPanel[6];for(inti=0;i<6;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtNo);p[1].add(txtDpartment);p[2].add(txtName);p[3].add(radSexM);p[3].add(radSexF);p[4].add(txtSpecial);p[5].add(txtID);for(inti=0;i<6;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);con.add(bottom);btnOK.addActionListener(this);btnCancel.addActionListener(this);setTitle("添加學(xué)生數(shù)據(jù)窗口");setSize(450,270);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==btnOK){FStudentfStudent=newFStudent();fStudent.setStudentNo(txtNo.getText());fStudent.setStudentNa(txtName.getText());fStudent.setStudentDe(txtDpartment.getText());fStudent.setStudentSex(radSexM.getText());fStudent.setStudentSex(radSexF.getText());fStudent.setStudentPo(txtSpecial.getText());fStudent.setStudentId(txtID.getText());IFStudentDaofStudentDao=newFStudentDao();if(!fStudentDao.addFStudent(fStudent)){JOptionPane.showMessageDialog(null,"添加失敗!");}else{JOptionPane.showMessageDialog(null,"添加成功!");dispose();}}}publicstaticvoidmain(String[]args){JFrame.setDefaultLookAndFeelDecorated(true);newFStudentAdd();}}View-FStudentEdit/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageview;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;/****@authorcomputer*/publicclassFStudentEditextendsJFrameimplementsActionListener{Stringtitle[]={"學(xué)號","院系","姓名","性別","專業(yè)","身份證號"};JTextFieldtxtNo=newJTextField(5);JTextFieldtxtDpartment=newJTextField(10);JTextFieldtxtName=newJTextField(10);JRadioButtonradSexM=newJRadioButton("男");JRadioButtonradSexF=newJRadioButton("女");JTextFieldtxtSpecial=newJTextField(10);JTextFieldtxtID=newJTextField(15);JButtonbtnOK=newJButton("保存");JButtonbtnCancel=newJButton("取消");publicFStudentEdit(){ButtonGroupgroup=newButtonGroup();group.add(radSexM);group.add(radSexF);Containercon=getContentPane();con.setLayout(newGridLayout(7,1));JPanelp[]=newJPanel[6];for(inti=0;i<6;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtNo);p[1].add(txtDpartment);p[2].add(txtName);p[3].add(radSexM);p[3].add(radSexF);p[4].add(txtSpecial);p[5].add(txtID);for(inti=0;i<6;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);con.add(bottom);btnOK.addActionListener(this);btnCancel.addActionListener(this);setTitle("添加學(xué)生數(shù)據(jù)窗口");setSize(450,270);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==btnOK){//newMainWindow;}else{dispose();}}publicstaticvoidmain(String[]args){JFrame.setDefaultLookAndFeelDecorated(true);newFStudentEdit();}}View-Hconsume/**Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.*Tochangethistemplatefile,chooseTools|Templates*andopenthetemplateintheeditor.*/packageview;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;/****@authorcomputer*/publicclassHConsumeextendsJFrameimplementsActionListener{Stringtitle[]={"學(xué)號","消費金額"};JTextFieldtxtNo=newJTextField(5);JTextFieldtxtDinmoney=newJTextField(5);JButtonbtnOK=newJButton("確認(rèn)");JButtonbtnCancel=newJButton("取消");publicHConsume(){Containercon=getContentPane();con.setLayout(newGridLayout(3,1));JPanelp[]=newJPanel[2];for(inti=0;i<2;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtNo);p[1].add(txtDinmoney);for(inti=0;i<2;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);

溫馨提示

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

最新文檔

評論

0/150

提交評論