




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
?java輸出學(xué)?信息表代碼_學(xué)?信息管理系統(tǒng)JAVASE版--1.1.1現(xiàn)在終于可以寫出實(shí)??點(diǎn)的程序了。雖然這個程序的功能?常之簡陋,?且還有BUG。不過最起碼已經(jīng)可以使?了。功能預(yù)覽和下?步的?標(biāo)程序主界?查詢功能:?前只做了?個表的增、刪、改、查。下?步應(yīng)該就是把功能完善,?如加?錯誤處理,?如加?成績部分。完成?個班級內(nèi)的學(xué)?信息管理的功能,應(yīng)該具有學(xué)?的基本信息查詢,成績管理這兩個功能不過有?個問題就是,在表格更新這?部分,每更新?次,就要創(chuàng)建?個tabliModel對象,感覺可以改進(jìn)。再有就是MVC模式,其實(shí)也就接觸設(shè)計(jì)模式。還有就是整成那種可執(zhí)??件。程序代碼mysql建表語句CREATETABLEstudent(stuIdINTPRIMARYKEY,stuNameVARCHAR(20)NOTNULLDEFAULT'',stuAgeINTNOTNULLDEFAULT0,stuSexVARCHAR(5)NOTNULLDEFAULT'')enginemyisamcharsetutf8;JAVA代碼:數(shù)據(jù)庫部分com.laolang.domain(數(shù)據(jù)對象,這?只有?個Student對象)packagecom.laolang.domain;/***學(xué)?對象,對應(yīng)數(shù)據(jù)庫中student表*/publicclassStudent{/***Instantiatesanewstudent.*/publicStudent(){super();}/***Instantiatesanewstudent.**@paramstuId*thestuid*@paramstuName*thestuname*@paramstuAge*thestuage*@paramstuSex*thestusex*/publicStudent(intstuId,StringstuName,intstuAge,StringstuSex){super();this.stuId=stuId;this.stuName=stuName;this.stuAge=stuAge;this.stuSex=stuSex;}/**(non-Javadoc)*
*@seejava.lang.Object#toString()*/@OverridepublicStringtoString(){return"Student[stuId="+stuId+",stuName="+stuName+",stuAge="+stuAge+",stuSex="+stuSex+"]";}/***Getsthestuid.**@returnthestuid*/publicintgetStuId(){returnstuId;}/***Setsthestuid.**@paramstuId*thenewstuid*/publicvoidsetStuId(intstuId){this.stuId=stuId;}/***Getsthestuname.**@returnthestuname*/publicStringgetStuName(){returnstuName;}/***Setsthestuname.
**@paramstuName*thenewstuname*/publicvoidsetStuName(StringstuName){this.stuName=stuName;}/***Getsthestuage.**@returnthestuage*/publicintgetStuAge(){returnstuAge;}/***Setsthestuage.**@paramstuAge*thenewstuage*/publicvoidsetStuAge(intstuAge){this.stuAge=stuAge;}/***Getsthestusex.**@returnthestusex*/publicStringgetStuSex(){returnstuSex;}/***Setsthestusex.
**@paramstuSex*thenewstusex*/publicvoidsetStuSex(StringstuSex){this.stuSex=stuSex;}/**學(xué)?編號*/privateintstuId;/**學(xué)?姓名*/privateStringstuName;/**學(xué)?年齡*/privateintstuAge;/**學(xué)?性別*/privateStringstuSex;}com.laolang.db(數(shù)據(jù)庫連接?具類,?的是屬性?件的?式)laolangDB(?具類)packagecom.laolang.db;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.util.ResourceBundle;/***數(shù)據(jù)庫連接和關(guān)閉?具類*/publicclasslaolangDB{/**數(shù)據(jù)庫連接地址*/privatestaticStringURL;/**數(shù)據(jù)庫?戶名*/privatestaticStringUSERNAME;/**數(shù)據(jù)庫密碼*/
privatestaticStringUSERPASSWORD;/**mysql驅(qū)動*/privatestaticStringDRIVER;/**Therb.*/privatestaticResourceBundlerb=ResourceBundle.getBundle("com.laolang.db.db-config");/***使?靜態(tài)代碼塊加載驅(qū)動*/static{URL=rb.getString("jdbc.url");USERNAME=rb.getString("jdbc.username");USERPASSWORD=rb.getString("jdbc.userpassword");DRIVER=rb.getString("jdbc.driver");try{Class.forName(DRIVER);}catch(ClassNotFoundExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}/***獲得鏈接.**@returntheconnection*/publicstaticConnectiongetConnection(){Connectionconn=null;try{conn=DriverManager.getConnection(URL,USERNAME,USERPASSWORD);}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}
returnconn;}/***關(guān)閉鏈接.**@paramrsthers*@parampstheps*@paramconntheconn*/publicstaticvoidcloseConnection(ResultSetrs,Statementps,Connectionconn){try{if(null!=rs)rs.close();if(null!=ps)ps.close();if(null!=conn)conn.close();}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}}perties(數(shù)據(jù)?件):jdbc.url=jdbc:mysql://localhost:3306/studentmanager1.1.1jdbc.username=rootjdbc.userpassword=123456jdbc.driver=com.mysql.jdbc.Drivercom.laolang.dao(數(shù)據(jù)庫操作接?)StudentDaopackagecom.laolang.dao;importjava.sql.SQLException;importjava.util.List;
importcom.laolang.domain.Student;/***數(shù)據(jù)庫操作接?*/publicinterfaceStudentDao{/***插?學(xué)?基本信息.**@paramstu*學(xué)?對象*@throwsSQLException*theSQLexception*/publicvoidinsertStudent(Studentstu)throwsSQLException;/***刪除學(xué)?基本信息.**@paramstuId*學(xué)?編號*@throwsSQLException*theSQLexception*/publicvoiddeleteStudent(intstuId)throwsSQLException;/***更新學(xué)?基本信息.**@paramstu*學(xué)?對象*@throwsSQLException*theSQLexception*/publicvoidupdateStudent(Studentstu)throwsSQLException;/***S通過編號查詢學(xué)?基本信息.
**@paramstuId*學(xué)?編號*@returnthestudent*@throwsSQLException*theSQLexception*/publicStudentselectStudentById(intstuId)throwsSQLException;/***查詢所有學(xué)?基本信息.**@returnthelist*@throwsSQLException*theSQLexception*/publicListselectStudentAll()throwsSQLException;}com.laolang.dao.impl(數(shù)據(jù)庫操作實(shí)現(xiàn))StudentDaoImplpackagecom.laolang.dao.impl;importjava.sql.SQLException;importjava.util.ArrayList;importjava.util.List;importmons.dbutils.QueryRunner;importmons.dbutils.handlers.BeanHandler;importmons.dbutils.handlers.BeanListHandler;importcom.laolang.dao.StudentDao;importcom.laolang.db.laolangDB;importcom.laolang.domain.Student;/***數(shù)據(jù)庫操作實(shí)現(xiàn)*/publicclassStudentDaoImplimplementsStudentDao{/**dbutils?具類對象*/
privateQueryRunnerrunner;/***Instantiatesanewstudentdaoimpl.*/publicStudentDaoImpl(){runner=newQueryRunner();}/**插?學(xué)?信息**@seecom.laolang.dao.StudentDao#insertStudent(com.laolang.domain.Student)*/@OverridepublicvoidinsertStudent(Studentstu)throwsSQLException{StringinsertStudent="insertintostudent(stuId,stuName,stuAge,stuSex)values(?,?,?,?)";runner.update(laolangDB.getConnection(),insertStudent,stu.getStuId(),stu.getStuName(),stu.getStuAge(),stu.getStuSex());}/**刪除學(xué)?信息**@seecom.laolang.dao.StudentDao#deleteStudent(int)*/@OverridepublicvoiddeleteStudent(intstuId)throwsSQLException{StringdeleteStudentById="deletefromstudentwherestuId=?";runner.update(laolangDB.getConnection(),deleteStudentById,stuId);}/**更新學(xué)?基本信息**@seecom.laolang.dao.StudentDao#updateStudent(com.laolang.domain.Student)*//*
*(non-Javadoc)**@seecom.laolang.dao.StudentDao#updateStudent(com.laolang.domain.Student)*/@OverridepublicvoidupdateStudent(Studentstu)throwsSQLException{StringupdateStudent="updatestudentsetstuName=?,stuAge=?,stuSex=?wherestuId=?";runner.update(laolangDB.getConnection(),updateStudent,stu.getStuName(),stu.getStuAge(),stu.getStuSex(),stu.getStuId());}/**通過編號查詢學(xué)?基本信息**@seecom.laolang.dao.StudentDao#selectStudentById(int)*/@OverridepublicStudentselectStudentById(intstuId)throwsSQLException{Studentstu=null;StringselectStudentById="selectstuName,stuAge,stuSexfromstudentwherestuId=?";stu=runner.query(laolangDB.getConnection(),selectStudentById,newBeanHandler(Student.class),stuId);stu.setStuId(stuId);returnstu;}/**查詢所有學(xué)?基本信息**@seecom.laolang.dao.StudentDao#selectStudentAll()*/@OverridepublicListselectStudentAll()throwsSQLException{StringselectStudentAll="selectstuId,stuName,stuAge,stuSexfromstudent";ListstudentList=runner.query(laolangDB.getConnection(),
selectStudentAll,newBeanListHandler(Student.class));returnstudentList;}}界?部分:com.laolang.ui(界?部分全部在這個包?)ManagerMainWidnows.java(這是主界?,也是啟動類)packagecom.laolang.ui;importjava.awt.BorderLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JOptionPane;importjavax.swing.JPanel;importjavax.swing.JScrollPane;importjavax.swing.JTable;importjavax.swing.JTextField;importcom.laolang.domain.Student;//TODO:Auto-generatedJavadoc/***功能:學(xué)?信息管理系統(tǒng)主界?版本:studentManager1.1.1作者:?代碼**/publicclassManagerMainWindowextendsJFrameimplementsActionListener{/***Themainmethod.**@paramargs*thearguments*/publicstaticvoidmain(String[]args){ManagerMainWindowmmw=newManagerMainWindow();
}/***Instantiatesanewmanagermainwindow.*/publicManagerMainWindow(){init();this.setActionCommand();this.setTitle("學(xué)?信息管理系統(tǒng)");this.setSize(400,300);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setVisible(true);}/***初始化窗體*/privatevoidinit(){//創(chuàng)建組件this.lbId=newJLabel("待查學(xué)?編號");this.butInsert=newJButton("增加");this.butDelete=newJButton("刪除");this.butUpdate=newJButton("修改");this.butSelect=newJButton("查詢");this.butShowAll=newJButton("顯?所有");this.tfId=newJTextField(10);this.jpNorth=newJPanel();this.jpSouth=newJPanel();this.stm=newStudentTableModel();stm.showAllData();this.jt=newJTable(stm);this.jsp=newJScrollPane(jt);//將組件添加到?板jpNorth.add(lbId);jpNorth.add(tfId);jpNorth.add(butSelect);
jpSouth.add(butInsert);jpSouth.add(butDelete);jpSouth.add(butUpdate);jpSouth.add(butShowAll);//將?板添加到窗體this.add(jpNorth,BorderLayout.NORTH);this.add(jsp,BorderLayout.CENTER);this.add(jpSouth,BorderLayout.SOUTH);}/***Setstheactioncommand.*/privatevoidsetActionCommand(){this.butInsert.addActionListener(this);this.butDelete.addActionListener(this);this.butUpdate.addActionListener(this);this.butSelect.addActionListener(this);this.butShowAll.addActionListener(this);this.butInsert.setActionCommand("insert");this.butDelete.setActionCommand("delete");this.butUpdate.setActionCommand("update");this.butSelect.setActionCommand("select");this.butShowAll.setActionCommand("show");}/**(non-Javadoc)事件處理**@see*java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)*/@OverridepublicvoidactionPerformed(ActionEvente){//如果?戶點(diǎn)擊添加if(e.getActionCommand().equals("insert")){
//System.out.println("insert");//彈出添加對話框,并得到添加對話框中輸?的值Studentstu=newStudentInsertDialog(this,"添加學(xué)?信息",true).getStu();//如果沒有點(diǎn)取消if(null!=stu){StudentTableModelstutm=newStudentTableModel();//?成新的modelstutm.insertStu(stu);//執(zhí)?插?jt.setModel(stutm);//更新表格model}}//如果點(diǎn)擊刪除elseif(e.getActionCommand().equals("delete")){//System.out.println("delete");//得到?戶選擇的?的?號intdelIndex=jt.getSelectedRow();//如果沒有選擇任何?,則提醒選擇??if(-1==delIndex){JOptionPane.showMessageDialog(this,"請選擇??之后,再進(jìn)?刪除操作","警告",JOptionPane.WARNING_MESSAGE);}if(-1!=delIndex){StringidStr=(String)stm.getValueAt(delIndex,0);intid=Integer.valueOf(idStr).intValue();//System.out.println(id);StudentTableModelstuTm=newStudentTableModel();//?成親的modelstuTm.deleteStu(id);//執(zhí)?刪除jt.setModel(stuTm);//更新表格model}}//如果?戶選擇更新elseif(e.getActionCommand().equals("update")){//System.out.println("update");//得到?戶選擇的?的?號
intupdataRowIndex=this.jt.getSelectedRow();//如果沒有選擇任何?,則提醒選擇??if(-1==updataRowIndex){JOptionPane.showMessageDialog(this,"請選擇??之后,再進(jìn)?修改操作","警告",JOptionPane.WARNING_MESSAGE);}if(-1!=updataRowIndex){Studentstu=newStudent();stu.setStuId(Integer.valueOf((String)stm.getValueAt(updataRowIndex,0)).intValue());stu.setStuName((String)stm.getValueAt(updataRowIndex,1));stu.setStuAge(Integer.valueOf((String)stm.getValueAt(updataRowIndex,2)).intValue());stu.setStuSex((String)stm.getValueAt(updataRowIndex,3));stu=newStudentUpdateDialog(this,"修改學(xué)?信息",true,stu).getStu();//如果修改了學(xué)?信息,則更新if(null!=null){StudentTableModelstutm=newStudentTableModel();//萬籟新的modelstutm.updateStu(stu);//執(zhí)?更新jt.setModel(stutm);//更新表格model//System.out.println(stu.toString());}}}//如果選擇查詢elseif(e.getActionCommand().equals("select")){//System.out.println("select");//得到輸?的學(xué)?編號intid=Integer.valueOf(tfId.getText()).intValue();StudentTableModelstutm=newStudentTableModel();//?成新modelstutm.selectStuId(id);//執(zhí)?查詢jt.setModel(stutm);//更新表格model}
//如果選擇顯?所有elseif(e.getActionCommand().equals("show")){//System.out.println("show");StudentTableModelstutm=newStudentTableModel();//?成新的modelstutm.showAllData();//執(zhí)?顯?所有jt.setModel(stutm);//更新表格model}}/**輸?編號標(biāo)簽*/privateJLabellbId;/**接收編號的輸?框*/privateJTextFieldtfId;/**插?按鈕*/privateJButtonbutInsert;/**刪除按鈕*/privateJButtonbutDelete;/**更新按鈕*/privateJButtonbutUpdate;/**查詢按鈕*/privateJButtonbutSelect;/**顯?所有按鈕*/privateJButtonbutShowAll;/**滾動窗格*/privateJScrollPanejsp;/**表格*/privateJTablejt;/**?于初始化表格的model*/privateStudentTableModelstm;/**北部paenl*/privateJPaneljpNorth;/**南部paenl*/privateJPaneljpSouth;}StudentTableModel.java(表格model)
packagecom.laolang.ui;importjava.sql.SQLException;importjava.util.List;importjava.util.Vector;importjavax.swing.table.AbstractTableModel;importcom.laolang.dao.StudentDao;importcom.laolang.dao.impl.StudentDaoImpl;importcom.laolang.domain.Student;//TODO:Auto-generatedJavadoc/***主窗?中,表格模型*/publicclassStudentTableModelextendsAbstractTableModel{/***Instantiatesanewstudenttablemodel.*/publicStudentTableModel(){init();}/***初始化,只完成表頭部分*/privatevoidinit(){rowData=newVector();colunmNames=newVector();colunmNames.add("編號");colunmNames.add("姓名");colunmNames.add("年齡");colunmNames.add("性別");}/***添加**@paramstuthestu
*/publicvoidinsertStu(Studentstu){try{sDao.insertStudent(stu);showAllData();}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}/***刪除**@paramidtheid*/publicvoiddeleteStu(intid){try{sDao.deleteStudent(id);showAllData();}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}/***更新**@paramstuthestu*/publicvoidupdateStu(Studentstu){try{sDao.updateStudent(stu);showAllData();}catch(SQLExceptione){
//TODOAuto-generatedcatchblocke.printStackTrace();}}/***查詢**@paramidtheid*@returnthestudent*/publicStudentselectStuId(intid){Studentstu=null;try{stu=sDao.selectStudentById(id);VectorstuV=newVector();stuV.add(String.valueOf(stu.getStuId()));stuV.add(stu.getStuName());stuV.add(String.valueOf(stu.getStuAge()));stuV.add(stu.getStuSex());rowData.add(stuV);}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}returnstu;}/***顯?所有*/publicvoidshowAllData(){if(0!=rowData.size()){rowData.clear();}try{
ListstuList=sDao.selectStudentAll();for(Studentstu:stuList){VectorstuV=newVector();stuV.add(String.valueOf(stu.getStuId()));stuV.add(stu.getStuName());stuV.add(String.valueOf(stu.getStuAge()));stuV.add(stu.getStuSex());rowData.add(stuV);}}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}/*(non-Javadoc)*設(shè)置表頭*@seejavax.swing.table.AbstractTableModel#getColumnName(int)*/@OverridepublicStringgetColumnName(intcolumn){return(String)colunmNames.get(column);}/*(non-Javadoc)*得到共有多少?*@seejavax.swing.table.TableModel#getRowCount()*/@OverridepublicintgetRowCount(){returnrowData.size();}/*(non-Javadoc)*得到共有多少列*@seejavax.swing.table.TableModel#getColumnCount()*/
@OverridepublicintgetColumnCount(){returncolunmNames.size();}/*(non-Javadoc)*得到某?某列的數(shù)據(jù)*@seejavax.swing.table.TableModel#getValueAt(int,int)*/@OverridepublicObjectgetValueAt(introwIndex,intcolumnIndex){return((Vector)rowData.get(rowIndex)).get(columnIndex);}/**Therowdata.*/privateVectorrowData;/**Thecolunmnames.*/privateVectorcolunmNames;/**Thesdao.*/publicstaticfinalStudentDaosDao=newStudentDaoImpl();}StudentInsertDialog(添加數(shù)據(jù)對話框)packagecom.laolang.ui;importjava.awt.BorderLayout;importjava.awt.FlowLayout;importjava.awt.Frame;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JDialog;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JTextField;importcom.laolang.domain.Student;
/***添加學(xué)?信息對話框*/publicclassStudentInsertDialogextendsJDialogimplementsActionListener{/***Instantiatesanewstudentinsertdialog.*/publicStudentInsertDialog(){super();}/***Instantiatesanewstudentinsertdialog.**@paramowner*theowner*@paramtitle*thetitle*@parammodal*themodal*/publicStudentInsertDialog(Frameowner,Stringtitle,booleanmodal){super(owner,title,modal);init();setComm();this.setSize(300,180);this.setVisible(true);this.setResizable(false);}/***初始化*/privatevoidinit(){//創(chuàng)建組件this.labelId=newJLabel("編號");
this.labelName=newJLabel("姓名");this.labelAge=newJLabel("年齡");this.labelSex=newJLabel("性別");this.tfId=newJTextField(20);this.tfName=newJTextField(20);this.tfAge=newJTextField(20);this.tfSex=newJTextField(20);this.butOk=newJButton("確定");this.butCanel=newJButton("取消");this.jpCenterLeft=newJPanel();this.jpCenterRight=newJPanel();this.jpCenter=newJPanel();this.jpSouth=newJPanel();//設(shè)置布局this.setLayout(newBorderLayout());this.jpCenterLeft.setLayout(newGridLayout(6,1));this.jpCenterRight.setLayout(newGridLayout(6,1));this.jpCenter.setLayout(newFlowLayout());this.jpSouth.setLayout(newFlowLayout());//添加組件到?板this.jpCenterLeft.add(this.labelId);this.jpCenterLeft.add(this.labelName);this.jpCenterLeft.add(this.labelAge);this.jpCenterLeft.add(this.labelSex);this.jpCenterRight.add(this.tfId);this.jpCenterRight.add(this.tfName);this.jpCenterRight.add(this.tfAge);this.jpCenterRight.add(this.tfSex);this.jpCenter.add(this.jpCenterLeft);this.jpCenter.add(this.jpCenterRight);this.jpSouth.add(this.butOk);this.jpSouth.add(this.butCanel);//?板添加到窗體this.add(this.jpCenter);
this.add(this.jpSouth,BorderLayout.SOUTH);}/***注冊監(jiān)聽、設(shè)置命令.*/privatevoidsetComm(){this.butOk.addActionListener(this);this.butCanel.addActionListener(this);this.butOk.setActionCommand("ok");this.butCanel.setActionCommand("canel");}/**(non-Javadoc)事件處理**@see*java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)*/@OverridepublicvoidactionPerformed(ActionEvente){if(e.getActionCommand().equals("ok")){//如果點(diǎn)擊確定,則創(chuàng)建?個Student對象,并對各個屬性賦值this.stu=newStudent();this.stu.setStuId(Integer.valueOf(this.tfId.getText()).intValue());this.stu.setStuName(this.tfName.getText());this.stu.setStuAge(Integer.valueOf(this.tfAge.getText()).intValue());this.stu.setStuSex(this.tfSex.getText());//隱藏對話框this.setVisible(false);}elseif(e.getActionCommand().equals("canel")){//如果點(diǎn)擊取消,則置Student為空this.stu=null;//隱藏對話框this.setVisible(false);}
}/**Thelabelid.*/privateJLabellabelId;/**Thelabelname.*/privateJLabellabelName;/**Thelabelage.*/privateJLabellabelAge;/**Thelabelsex.*/privateJLabellabelSex;/**Thetfid.*/privateJTextFieldtfId;/**Thetfname.*/privateJTextFieldtfName;/**Thetfage.*/privateJTextFieldtfAge;/**Thetfsex.*/privateJTextFieldtfSex;/**Thebutok.*/privateJButtonbutOk;/**Thebutcanel.*/privateJButtonbutCanel;/**Thejpcenterleft.*/privateJPaneljpCenterLeft;/**Thejpcenterright.*/privateJPaneljpCenterRight;/**Thejpcenter.*/privateJPaneljpCenter;/**Thejpsouth.*/privateJPaneljpSouth;/**Thestu.*/privateStudentstu;/***Getsthestu.*
*@returnthestu*/publicStudentgetStu(){returnstu;}}StudentUpdateDialog(修改數(shù)據(jù)對話框)packagecom.laolang.ui;importjava.awt.BorderLayout;importjava.awt.FlowLayout;importjava.awt.Frame;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JDialog;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JTextField;importcom.laolang.domain.Student;//TODO:Auto-generatedJavadoc/***學(xué)?信息更新對話框本類有?個Student對象,?于記錄各輸?框中的值*/publicclassStudentUpdateDialogextendsJDialogimplementsActionListener{/***Instantiatesanewstudentinsertdialog.*/publicStudentUpdateDialog(){super();}/***Instantiatesanewstudentinsertdialog.
**@paramowner*theowner*@paramtitle*thetitle*@parammodal*themodal*@paramstu*thestu*/publicStudentUpdateDialog(Frameowner,Stringtitle,booleanmodal,Studentstu){super(owner,title,modal);init(stu);setComm();setSize(300,180);setVisible(true);setResizable(false);}/***創(chuàng)建各組件**@params*thes*/privatevoidinit(Students){stu=newStudent();//創(chuàng)建Student對象//設(shè)置各屬性值為選中?的相應(yīng)的值stu.setStuId(s.getStuId());stu.setStuName(s.getStuName());stu.setStuAge(s.getStuAge());stu.setStuSex(s.getStuSex());//創(chuàng)建組件labelId=newJLabel("編號");
labelName=newJLabel("姓名");labelAge=newJLabel("年齡");labelSex=newJLabel("性別");tfId=newJTextField(String.valueOf(stu.getStuId()),20);tfId.setEditable(false);tfName=newJTextField(stu.getStuName(),20);tfAge=
溫馨提示
- 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)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 遼陽古建施工方案審批
- 2024年三季度報(bào)湖南地區(qū)A股銷售凈利率排名前十大上市公司
- 快船新球館施工方案
- (教研室)福建省寧德市2024-2025學(xué)年高二上學(xué)期期末考試語文試題
- 揚(yáng)塵施工方案
- 預(yù)制濾板施工方案
- 2025年柳工營銷面試題及答案
- 6年級上冊20課青山不老課堂筆記
- 教育教學(xué)評價(jià)表
- 低空經(jīng)濟(jì)產(chǎn)業(yè)專項(xiàng)引導(dǎo)基金
- 裝配式建筑疊合板安裝技術(shù)交底
- 2022年HTD-8M同步帶輪尺寸表
- 皮帶滾筒數(shù)據(jù)標(biāo)準(zhǔn)
- 腳手架操作平臺計(jì)算書
- 內(nèi)科學(xué)第八版循環(huán)系統(tǒng)教學(xué)大綱
- 煤礦供電系統(tǒng)及供電安全講座方案課件
- 綠色建筑及材料分析及案列
- 實(shí)用中西醫(yī)結(jié)合診斷治療學(xué)
- 幕墻工程技術(shù)標(biāo)范本
- 《施工方案封面》
- (完整版)ppt版本——哈工大版理論力學(xué)課件(全套)01
評論
0/150
提交評論