java课设 医院管理信息系统_第1页
java课设 医院管理信息系统_第2页
java课设 医院管理信息系统_第3页
java课设 医院管理信息系统_第4页
java课设 医院管理信息系统_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

医院管理信息系统1需求分析1.1现状当前,医院作为病人就诊的地方,有许多信息需要处理和管理。现今,有很多门诊信息都是初步开始使用,甚至尚未使用计算机进行信息处理。根据调查得知,他们以前对信息管理的主要方式是基于文本、表格等纸介质的手工处理,对于医历等很多信息都是用人工计算、手抄进行。数据信息处理工作量大,容易出错;由于数据繁多,容易丢失,且不易查找。总的来说,缺乏系统,规范的信息管理手段。数据处理手工操作,工作量大,出错率高,出错后不易更改。基于这此问题,我认为有必要建立一个医院管理系统,使医院管理工作规范化,系统化,程序化,避免医院管理的随意性,提高信息处理的速度和准确性,能够及时、准确、有效的查询和修改医院情况。医院信息系统简称HIS,是HospitalInformationSystem的简称,是指利用计算机和网络通信设备,为医院所属的各个部门提供病人诊疗和行政管理信息的手机、存储、处理提取和数据交换的能力。此次我课程设计的目标就是设计一个能使医院的管理工作系统化、规范化、自动化的系统,从而提高医院管理工作的效率。1.2模块功能本系统功能主要包括:员工信息、病人信息、药剂管理、仪器管理、工资管理、病床管理。员工信息:储存了医院的医务人员的基本情况,包括员工编号,姓名,性别,所在部门,联系电话等信息。员工各种的查询、修改,包括员工基本信息、职称、岗位、工资等。员工的人事调动管理。病人信息:病人基本资料表中所有项目(姓名,性别,婚否,出生日期,职业,职称,门诊诊断),病人基本资料表录入、修改、删除、复制。药剂管理:实现对医院药品信息的分类管理和数据分析,从而使信息整理快速、准确、简单,以便于相关部门给予统筹安排,从而提高改进传统的管理方法,提高企业管理水平。

仪器管理:保存了医院所需医疗用品的基本情况,库存量和单品价格。以便管理人员查看,随时进行补货。工资管理:存储医生员工号,工资级别和工资总额,管理人员可以进行增删查改。病床管理:实现床位分配、空床查询、包床/退床、转床出院处理。医院管理信息系统员工信息管理病人信息管理药剂管理仪器管理工资管理病床管理员工信息管理病人信息管理药剂管理仪器管理工资管理病床管理图1.功能结构图1.3用例图图2.用例图2系统设计2.1识别需求文档中的类管理员管理员工编号,姓名,性别,所在部门,联系电话等信息,进行增删查改。普通用户查看员工信息。管理员设置病人姓名,性别,婚否,出生日期,职业,职称,门诊诊断,进行病人基本资料表录入、修改、删除、查询。管理员实现对医院药品信息的分类管理,进行增删查改。管理员保存医院所需医疗用品的基本情况,库存量和单品价格。管理员录入医生员工号,工资级别和工资总额,进行增删查改。普通用户查看自己的工资。管理员实现床位分配、空床查询、包床/退床、转床出院处理。需求文档中的名词/名词短语,按照出现顺序,从左到右排列(不重复):管理员(admin)、普通用户(person)、病人(invalid)、药品(stuff)、医疗用品)(apparatus、工资(pay)、床位(bed)。2.2初步建模类及类间关系员工信息包括:医生编号、姓名、性别、学历、职务、所在科室。病人基本情况描述包括病人的病人编号、姓名、性别、联系电话、籍贯、国家、民族、身份证号、健康状况、科室名称、病房号、床号。病号唯一确定一个病人。药品信息描述包括:药品编号、药品名称、库存量、单价。仪器信息描述包括:仪器代号、名称、单价、数量。床位信息描述包括床号、病房号、是否已住人。一个床号和病房号唯一确定一个床位情况。2.3初步的UML图Database+sql:String+url:String+user:String+password:String+<<create>>Database()+OpenConn():void+executeQuery(insql:String):ResultSet+executeUpdate(insql:Sring):boolean+closestmt():void+closeConn():void图^.DatabaseUML设计Apparatus+Datas:String+Columntitles:String+type:int+<<create>>Apparatus(indatas:String[][],intype:int)+actionPerformed(ine:ActionEvent):void图《ApparatusUML设计Invalid+datas:String+columntitles:String+type:int+<<create>>Invalid(indatas:String[][],intype:int)+actionPerformed(ine:ActionEvent):void图5.InvalidUML设计Personcheck-pclass:String+columns:String+datas:String+<<create>>Personcheck(indata:String[][])+actionPerformed(ine:ActionEvent):void图6.PersoncheckUML设计Invalidcheck-pclass:String+columns:String+datas:String+<<create>>Invalidcheck(indata:String[][])+actionPerformed(ine:ActionEvent):void图8.InvalidcheckUML设计Invalidadd-pclass:String+<<create>>lnvalidadd()+actionPerformed(ine:ActionEvent):void图9.InvalidaddUML设计InvalidBeansql:Stringiname:Stringsex:stringpclass:Stringstate:Stringdoctor:Stringitime:Stringrno:Stringbno:StringAdd(inname:String,insex:String,intime:String,inplass:String,instate:String,indoctor:String,inrno:String,inbno:String):voidsearchInvalidiname(ininame:String):String[]editInvalid(ininame:String,insex:String,initime:String,inplass:String,instate:String,indoctor:String,inrno:String,inbno:String):voiddelete【nvalid(ininame:String):voidsearchAlllnvalidor(ininame:String,initime:String,inpclass:String,instate:String,inrno:String,inbno:String):String[][]searchAlllnvalidand(ininame:String,initime:String,inpclass:String,instate:String,inrno:String,inbno:String):String[][]getAlliname():String[]refresh():String[][]图10.InvalidBeanUML设计3系统实现3.1UML类图转换成Java代码框架Database.Java是数据库连接,源代码如下:publicclassDatabase{publicDatabase(){}publicvoidOpenConn()throwsException!try{}catch(Exceptione){}}publicResultSetexecuteQuery(Stringsql){}catch(SQLExceptione){}}publicbooleanexecuteUpdate(Stringsql){}publicvoidcloseStmt(){}}publicvoidcloseConn(){publicstaticvoidmain(String[]args)throwsException}}Personframe.java为员工信息窗口的代码,可以进行查询,删除,刷新,修改,源代码如下:publicclassPersonFrameextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_delete;privateJButtonbutton_refresh;privateJButtonbutton_update;privateJTabletable;//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={"员工号〃,〃员工姓名〃,〃性别〃,〃所在部门〃,〃身份证〃,〃生日〃/籍贯","国家","民族","婚姻状况","健康状况","工作时间","家庭住址","联系电话〃};publicPersonFrame(Stringdatas[][],inttype){publicbooleanisCellEditable(introw,intcolumn){returnfalse;}//表格不允许被编辑};}@OverridepublicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(String[]args)//测试方法{//newPersonFrame(null,0);Invalid.java是病人管理模块的代码,可以进行入院,查询,刷新和更新的操作,源代码如下:publicclassInvalidextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_edit;privateJButtonbutton_refresh;privateJButtonbutton_delete;privateJTabletable;//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={〃病人姓名〃,〃病人性别〃,〃入院时间〃,〃所属科室〃,〃病人状况〃,〃主治医生〃,〃病房号〃,〃病床号〃};publicInvalid(Stringdatas[][],inttype){publicbooleanisCellEditable(introw,intcolumn){returnfalse;}//表格不允许被编辑};}@OverridepublicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(String[]args)//测试方法{//newInvalid(null,0);}}Apparatus.java是对仪器进行管理,源代码如下:publicclassApparatusextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_edit;privateJButtonbutton_refresh;privateJButtonbutton_delete;privateJTabletable;//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={〃仪器代号","仪器名称","仪器价格","仪器数量","备注"};inttype;publicApparatus(Stringdatas[][],inttype){publicbooleanisCellEditable(introw,intcolumn){returnfalse;}//表格不允许被编辑};}@OverridepublicvoidactionPerformed(ActionEvente){publicstaticvoidmain(String[]args)//测试方法{newApparatus(null,0);}Stu任java是药剂管理,可以查询库存药品的信息,源代码如下:publicclassStuffextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_edit;privateJButtonbutton_refresh;privateJButtonbutton_delete;//表格组件privateJTable//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={〃药剂代号〃,〃药剂名称〃,〃药剂价格〃,〃储存量〃,〃备注〃};inttype;publicStuffCStringdatas[][],inttype){}@OverridepublicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(String[]args)//测试方法{newStufftnull,。);}}Pay.Java是对员工工资进行管理录入的操作,源代码如下:publicclassPayextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_edit;privateJButtonbutton_refresh;privateJButtonbutton_delete;privateJTabletable;//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={〃员工号〃,〃工资等级〃,〃工资总额〃}publicPay(Stringdatas[][]){}@OverridepublicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(String[]args)//测试方法{newPay(null);}Bed.java是对医院病床进行管理,显示病房及病床的使用信息,源代码如下:PublicclassBedextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_check;privateJButtonbutton_refresh;privateJButtonbutton_delete;privateJTabletable;//表格组件privateDefaultTableModeltableModel;Stringdatas[][];String[]columntitles={"病床号","病房号","状态"};publicBed(Stringdatas[][]){publicbooleanisCellEditable(introw,intcolumn){returnfalse;}//表格不允许被编辑};}@OverridepublicvoidactionPerformed(ActionEvente){}publicstaticvoidmain(String[]args)//测试方法{newBed(null);}3.2添加表示层,实现交互功能3.2.1Login类系统的用户有管理员、医生,因此,在进入主界面之前,应该先弹出登录界面,要求用户输入用户编号(姓名可能重名)和登录口令,以验证用户身份。因此,我们首先需要设计一个登录界面一一Login类。

g=1■・Jjnamepasswordflag1■II■■■■■■■■■■■■■■■■■■■■■■■■■■■:sdmin:admin12xiayu脚GJfanrui11104luhaijuBn22205xinchaa理0叵j整户登录耳败迎登陆医院管理信息系统叵j整户登录耳败迎登陆医院管理信息系统importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;publicclassLoginextendsJFrameimplementsActionListener{privateJLabeluser,password;privateJTextFieldtext_user;//用户名文本行privateJPasswordFieldtext_password;//密码文本行privateJButtonbutton_ok,button_cancel;privateJComboBoxtypeBox;JLabeljlabel;//判断登录是否成功publicbooleanisLogin=false;publicLogin(){super("用户登录");this.setSize(240,150);this.setLocation(550,200);this.setBackground(Color.lightGray);this.setResizable(false);this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);this.getContentPane().setLayout(newFlowLayout());jlabel=new儿abel("欢迎登陆医院管理信息系统"JLabel.CENTER);this.getContentPane().add(jlabel);user=newJLabel("用户名:");user.setFont(newFont("Dialog",0,12));this.getContentPane().add(user);text_user=newJTextField(15);text_user.setEditable(true);this,getContentPane().add(text_user);password=newJLabel("密码:");password.setFont(newFont("Dialog",0,12));this,getContentPane().add(password);text_password=newJPasswordField(15);this,getContentPane().add(text_password);Stringtypes[]={"普通用户","管理员"};typeBox=newJComboBox(types);button_ok=newJButtonC"登录");button_ok.setFont(newFont("Dialog”,0,12));this.getContentPane().add(newLabel。);this.getContentPane().add(typeBox);this.getContentPaneO,add(button_ok);button_ok.addActionListener(this);button_cancel=newJButton("取消");button_cancel.setFont(newFont("Dialog",0,12));this.getContentPane().add(button_cancel);button_cancel.addActionListener(this);this.setVisible(true);}publicvoidactionPerformed(ActionEvente)//单击事件处理方法{Stringusername=text_user.getText();Stringpassword=newString(text_password.getPassword());if(e.getSource()==button_cancel)//单击退出按钮{this.setVisible(false);}elseif(username,equals(""))JOptionPane.showMessageDialog(this,〃请输入用户名〃)elseif(password.equals(""))JOptionPane.showMessageDialog(this,〃密码不能为空,请输入密码〃);elseif(e.getSourceO==button_ok)////判断登录是否成功{LoginBeanlogin=newLoginBean();isLogin=login.enter(username,password);inttype=typeBox.getSelectedIndex();if(isLogin){if(login.Flag==type){newHOSMain(type);}else{JOptionPane.showMessageDialog(this,"登陆身份不正确!");return;}{text_user.setText("");text_password.setText("");}this.setVisible(false);}}

publicvoidwindowClosing(WindowEvente){}publicvoidwindowOpened(WindowEvente){}publicvoidwindowClosed(WindowEvente){}publicvoidwindowIconifiedCWindowEvente){}publicvoidwindowDeiconified(WindowEvente){}publicvoidwindowActivated(WindowEvente){}publicvoidwindowDeactivated(WindowEvente){}publicstaticvoidmain(Stringargs[])throwsException{newLogin();}}3.2.2HosMain类//打开窗口//关闭窗口后//窗口最小化//窗口恢复//激活窗口////打开窗口//关闭窗口后//窗口最小化//窗口恢复//激活窗口//变为不活动窗口//测试方法该界面显示了整个系统的代码如下:importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.sql.*;/***系统主界面*/publicclassHOSMainextendsJFrameimplementsActionListener{DimensionfaceSize=newDimension(450,550);JPanelcontentPane;JButtonbuttonPersonFrame;的MISH((。哀」」uofduO专eppBI&(()一MMnL一Fu£ro't?隅壬四乙uotn竺MMAWLJJuotnqo、fi*««、)u。)%竺MMnp^uotJ(fi*mH、)uotn竺MML£uot2(翩*器罢口u。)%竺MMnsEW&dyuotJ(、翩姬宗嫁乙u。)%竺MMWESUOtJ■皿eYK乙u。)%竺MMnp.一忑£u。击oi'eH吧乙u。tn竺mm&EE」uofdu。t2(oOLoosuowuo-1毛*.一壬.ct?隅nifinnffiffi乙。一)LL-tjs.^)(ooLndosozy毛*一壬QSCTD—NoltxLJJ)uow切dcpsu土n毛*一壬dJd>)nOJd>七松LI)二。doruuawsoHMqDdr一Qpqu。专qu。专竺书。军。12uotn竺(泠生。专qUO专竺KEW&dyu。专quo专竺专EsuotJuotn竺TEUMO专qu。专竺JPanelpanel2=newJPanel();panel2.add(buttonInvalid);JPanelpanel3=newJPanel();panel3.add(buttonStu的;JPanelpanel4=newJPanel();panel4.add(buttonApparatus);JPanelpanel5=newJPanel();panel5.add(buttonPay);JPanelpanel6=newJPanel();panel6.add(buttonBed);JPanelpanel7=newJPanel();panel7.add(buttonExit);Imageiconfirstpage=newImageIcon("abc.PNG");this.getContentPane().setLayout(newBorderLayout());JPanelpanel=newJPanel();panel.add(panell);panel.add(panel2);panel.add(panel3);panel.add(panel4);panel.add(panel5);panel.add(panel6);panel.add(panel7);this.getContentPane().add(panel,BorderLayout.NORTH);this.getContentPane().add(new儿abel(firstpage),BorderLayout.CENTER);buttonPersonFrame.addActionListener(this);buttonlnvalid,addActionListener(this);buttonStuf?addActionListener(this);buttonApparatus.addActionListener(this);buttonPay,addActionListener(this);buttonBed,addActionListener(this);buttonExit.addActionListener(this);//关闭程序时的操作this.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});this.setVisible(true);}publicvoidactionPerformed(ActionEvente)if(e.getSource()==buttonPersonFrame){newPersonFrame(null,type);}if(e.getSource()==buttonInvalid){newInvalid(null,type);}i"e.getSourceO==buttonStuff){newStufi(null,type);}if(e.getSource()==buttonApparatus){newApparatus(null,type);}if(e.getSource()==buttonPay){newPay(null);}if(e.getSourceO==buttonBed)newBed(null);}i"e.getSource()==buttonExit){JOptionPane.showConfirmDialog(null,"您确定退出系统吗?","消息",JOptionPane.YES_NO_OPTION);System.exit(0);}}publicstaticvoidmain(String[]args){newHOSMain(1);}}3.2.3ApparatusBean类点击进入仪器管理的界面,实现添加、修改、查询、删除的操作。importjava.util.*;importjava.util.Date;importjava.sql.*;importjava.awt.*;importjavax.swing.*;publicclassApparatusBean{Stringsql;ResultSetrs=null;Stringano;Stringaname;Stringaprice;Stringamount;Stringexplain;publicvoidadd(Stringano,Stringaname,Stringaprice,Stringamount,Stringexplain){DatabaseDB=newDatabase。;sql="insertintoapparatusvalues('〃+ano+"/'+aname+〃/'+aprice+〃/'+amount+〃/'+explain+'〃)";try{DB.OpenConn();DB.executeUpdate(sql);JOptionPane.showMessageDialog(null,"成功添加仪器信息!");}catch(Exceptione){System.out.println(e);JOptionPane.showMessageDialog(null,"保存失败","错误",JOptionPane.ERROR_MESSAGE);}finally{DB.closeStmt();DB.closeConn();}}publicString[]searchApparatusano(Stringano){DatabaseDB=newDatabase。;this.ano=ano;String[]s=newString[5];sql="selectdistinct*fromapparatuswhereano=〃'+ano+'〃";try{DB.OpenConn();rs=DB.executeQuery(sql);if(rs.next()){s[0]=rs.getString(1);s[1]=rs.getString(2);s[2]=rs.getString(3);s[3]=rs.getString(4);s[4]=rs.getString(5);}elses=null;}catch(Exceptione){}finally{DB.closeStmt();DB.closeConn();}returns;}publicvoideditApparatus(Stringano,Stringaname,Stringaprice,Stringamount,Stringexplain){DatabaseDB=newDatabase。;this.ano=ano;this.aname=aname;this.aprice=aprice;this.amount=amount;this.explain=explain;sql="updateapparatussetaname=〃'+aname+'〃,aprice='"+aprice+"',amount=〃'+amount+'〃,explain='"+explain+"'";try{DB.OpenConn();DB.executeUpdate(sql);JOptionPane.showMessageDialog(null,"成功修改一条仪器信息!");}catch(Exceptione){JOptionPane.showMessageDialog(null,"更新失败","错误",JOptionPane.ERROR_MESSAGE);}finally{DB.closeStmt();DB.closeConn();}}publicString[][]searchAllApparatusor(Stringano,Stringaname,Stringaprice,Stringamount){this.ano=ano;this.aname=aname;this.aprice=aprice;this.amount=amount;DatabaseDB=newDatabase。;Stringresult[][]=null;sql="select*fromapparatuswhereano='"+ano+"'oraname='"+aname+"'oraprice='"+aprice+"'oramount='"+amount+"'";try{DB.OpenConn();rs=DB.executeQuery(sql);ResultSetMetaDatarsmd=rs.getMetaDataO;intcolumns=rsmd,getColumnCount();introws=0;while(rs.next()){rows++;}if(rows==0){JOptionPane.showMessageDialog(null,〃未查询到符合条件的仪器,请重新输入!",〃错误〃,JOptionPane.ERROR_MESSAGE);}Strings[][]=newString[rows][columns];rs.beforeFirstO;for(inti=0;rs.next();i++)for(intj=1;j<=columns;j++)s[i][j-1]=rs.getString(j);result=s;}catch(Exceptione){}finally{DB.closeStmt();DB.closeConn();}returnresult;}publicString[][]searchAllApparatusand(Stringano,Stringaname,Stringaprice,Stringamount){this.ano=ano;this.aname=aname;this.aprice=aprice;this.amount=amount;DatabaseDB=newDatabase。;Stringresult[][]=null;sql="select*fromapparatuswhereano='"+ano+"'andaname='+aname+"'andaprice='"+aprice+"'andamount='"+amount+"'";try{DB.OpenConn();rs=DB.executeQuery(sql);ResultSetMetaDatarsmd=rs.getMetaData();intcolumns=rsmd,getColumnCount();introws=0;while(rs.next()){rows++;}if(rows==0){JOptionPane.showMessageDialog(null,〃未查询到符合条件的仪器,请重新输入!","错误",JOptionPane.ERROR_MESSAGE);}Strings[][]=newString[rows][columns];rs.beforeFirstO;for(inti=0;rs.next();i++)for(intj=1;j<=columns;j++)s[i][j-1]=rs.getString(j);result=s;}catch(Exceptione){}finally{DB.closeStmt();DB.closeConn();}returnresult;}publicString[]getAllano(){String[]s=null;introw=0;inti=0;DatabaseDB=newDatabase。;sql="selectdistinctanofromapparatus";try{DB.OpenConn();rs=DB.executeQuery(sql);if(rs.last()){row=rs.getRow();}if(row==0){s=null;}else{s=newString[row];rs.first();rs.previous();while(rs.next()){s[i]=rs.getString(1);i+十;}}}catch(Exceptione){System.out.println(e);}finally{DB.closeStmt();DB.closeConn();}returns;}publicString[][]refresh。{DatabaseDB=newDatabase。;Stringresult[][]=null;sql="select*fromapparatus";try{DB.OpenConn();rs=DB.executeQuery(sql);ResultSetMetaDatarsmd=rs.getMetaData();intcolumns=rsmd,getColumnCount();introws=0;while(rs.next()){rows++;}if(rows==0){JOptionPane.showMessageDialog(null,〃没有该仪器记录!","提示",1);}Strings[][]=newString[rows][columns];rs.beforeFirstO;

for(inti=0;rs.next();i++)for(intj=1;j<=columns;j++)s[i][j-1]=rs.getString(j);result=s;}catch(Exceptione){}finally{DB.closeStmt();DB.closeConn();}returnresult;}publicString[][]searchAllStuffotringtext,Stringtext2,Stringtext3,Stringtext4){returnnull;}}3.2.4Apparatusadd类对医院仪器信息进行添加。伙器代号:仪器价格:备注:importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.*;publicclassApparatusaddextendsJFrameimplementsActionListener{privateJButtonbutton_add;privateJButtonbutton_cancel;privateJButtonbutton_clear;TOC\o"1-5"\h\zprivateJLabellabel_ano=newJLabel("仪器代号:");privateJLabellabel_aname=newJLabel("仪器名称:");privateJLabellabel_aprice=newJLabel("仪器价格:");privateJLabellabel_amount=newJLabel("储存量:");privateJLabellabel_explain=newJLabel("备注:");privateJTextFieldtext_ano;privateJTextFieldtext_aname;privateJTextFieldtext_aprice;privateJTextFieldtext_amount;privateJTextFieldtext_explain;GridBagLayoutgridBag=newGridBagLayout();GridBagConstraintsgridBagCon;publicApparatusadd(){super("新增仪器信息");this.setSize(700,300);this.setLocation(320,120);this.setBackground(Color.lightGray);this.setResizable(false);this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);//添加主面板JPanelmain=newJPanel();main.setLayout(gridBag);this.getContentPane().add(main,"Center");label_ano.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints。;gridBagCon.gridx=0;//第0列gridBagCon.gridy=0;//第0彳亍gridBagCon.insets=newInsets(10,10,10,1);gridBag.setConstraints(label_ano,gridBagCon);main.add(label_ano);gridBagCon=newGridBagConstraints();gridBagCon.gridx=1;gridBagCon.gridy=0;gridBagCon.insets=newInsets(10,1,10,15);text_ano=newJTextField(15);gridBag,setConstraints(text_ano,gridBagCon);main.add(text_ano);label_aname.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints();gridBagCon.gridx=2;gridBagCon.gridy=0;gridBagCon.insets=newInsets(10,15,10,1);gridBag,setConstraints(label_aname,gridBagCon);main.add(label_aname);gridBagCon=newGridBagConstraints();gridBagCon.gridx=3;gridBagCon.gridy=0;gridBagCon.insets=newInsets(10,1,10,10);text_aname=newJTextField(15);gridBag,setConstraints(text_aname,gridBagCon);main.add(text_aname);label_aprice.setFont(newFont("Dialog”,0,14));gridBagCon=newGridBagConstraints();gridBagCon,gridx=0;gridBagCon,gridy=1;gridBagCon.insets=newInsets(10,15,10,1);gridBag,setConstraints(label_aprice,gridBagCon);main.add(label_aprice);gridBagCon=newGridBagConstraints();gridBagCon.gridx=1;gridBagCon.gridy=1;gridBagCon.insets=newInsets(10,1,10,10);text_aprice=newJTextField(15);gridBag,setConstraints(text_aprice,gridBagCon);main.add(text_aprice);label_amount.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints();gridBagCon.gridx=2;gridBagCon.gridy=1;gridBagCon.insets=newInsets(10,15,10,1);gridBag,setConstraints(label_amount,gridBagCon);main.add(label_amount);gridBagCon=newGridBagConstraints();gridBagCon.gridx=3;gridBagCon.gridy=1;gridBagCon.insets=newInsets(10,1,10,10);text_amount=newJTextField(15);gridBag,setConstraints(text_amount,gridBagCon);main.add(text_amount);label_explain.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints();gridBagCon,gridx=0;gridBagCon,gridy=2;gridBagCon.insets=newInsets(10,15,10,1);gridBag,setConstraints(label_explain,gridBagCon);main.add(label_explain);gridBagCon=newGridBagConstraints();gridBagCon.gridx=1;gridBagCon.gridy=2;gridBagCon.insets=newInsets(10,1,10,10);text_explain=newJTextField(15);gridBag,setConstraints(text_explain,gridBagCon);main.add(text_explain);//添加增加、清空、取消按钮JPaneldown=newJPanel();button_add=newJButton("增加");button_add.setFont(newFont("Dialog",0,14));button_add,addActionListener(this);button_clear=newJButton("清空");button_clear.setFont(newFont("Dialog",0,14));button_clear.addActionListener(this);button_cancel=newJButton("取消");button_cancel.setFont(newFont("Dialog",0,14));button_cancel.addActionListener(this);down.add(button_add);down.add(button_clear);down.add(button_cancel);this.getContentPane().add(down,"South");this.setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e,getSource()==button_add){StuffBeanp=newStuffBean();p.add(text_ano.getTextO,text_aname,getTextO,text_aprice,getTextO,text_amount.getText(),text_explain.getTextO);}if(e,getSource()==button_clear){text_ano.setText("");text_aname,setText("");text_aprice,setText("");text_amount,setText("");text_explain.setText("");

if(e.getSource()==button_cancel){this.setVisible(false);}}publicstaticvoidmain(String[]args){newApparatusadd();}}3.2.5Apparatuscheck类对仪器信息进行查询。返回基本信息二量;仪器价格:备注;更新暇梢importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;importjavax.swing.table.*;publicclassApparatuscheckextendsJFrameimplementsActionListener{privateJLabellabel=newJLabel("设置查询条件:");对仪器信息进行查询。返回基本信息二量;仪器价格:备注;更新暇梢TOC\o"1-5"\h\zprivateJLabellabel_ano=newJLabel("仪器代号:");privateJLabellabel_aname=newJLabel("仪器名称:");privateJLabellabel_aprice=newJLabel("仪器价格:");privateJLabellabel_amount=newJLabel("储存量:");privateJTextFieldtext_ano;privateJTextFieldtext_aname;privateJTextFieldtext_aprice;privateJTextFieldtext_amount;privateJButtonbutton_searchl,button_search2,button_clear,button_cancel;privateJTabletable;//表格组件privateDefaultTableModeltableModel;String[]columns={〃仪器代号〃,〃仪器名称〃,〃仪器价格〃,〃仪器数量〃,〃备注〃};Stringdatas[][];GridBagLayoutgridBag=newGridBagLayout();GridBagConstraintsgridBagCon;publicApparatuscheck(Stringdata[][]){super(〃仪器信息查询〃);this.setSize(800,600);this.setLocation(300,80);this.setBackground(Color.lightGray);this.setResizable(false);this.setDefaultCloseOperation(D【SPOSE_ON_CLOSE);this.datas=data;JSplitPanejs=newJSplitPane(JSplitPane.VERT【CAL_SPL【T);JPanelup=newJPanel();up.setLayout(gridBag);js.add(up);this.getContentPane().add(js);label.setFont(newFont(〃Dialog〃,0,18));gridBagCon=newGridBagConstraints。;gridBagCon.gridx=0;//第。列gridBagCon.gridy=0;//第0彳亍gridBagCon.insets=newInsets(10,10,10,1);gridBag,setConstraints(label,gridBagCon);up.add(label);label_ano.setFont(newFont("Dialog”,0,14));gridBagCon=newGridBagConstraints();gridBagCon.gridx=0;gridBagCon.gridy=1;gridBagCon.insets=newInsets(10,10,10,1);gridBag,setConstraints(label_ano,gridBagCon);up.add(label_ano);gridBagCon=newGridBagConstraints();gridBagCon.gridx=1;gridBagCon.gridy=1;gridBagCon.insets=newInsets(10,1,10,15);text_ano=newJTextField(15);gridBag,setConstraints(text_ano,gridBagCon);up.add(text_ano);label_aname.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints();gridBagCon,gridx=2;gridBagCon,gridy=1;gridBagCon.insets=newInsets(10,10,10,1);gridBag,setConstraints(label_aname,gridBagCon);up.add(label_aname);gridBagCon=newGridBagConstraints();gridBagCon,gridx=3;gridBagCon,gridy=1;gridBagCon.insets=newInsets(10,1,10,15);text_aname=newJTextField(15);gridBag.setConstraints(text_aname,gridBagCon);up.add(text_aname);label_aprice.setFont(newFont("Dialog”,0,14));gridBagCon=newGridBagConstraints();gridBagCon.gridx=0;gridBagCon.gridy=2;gridBagCon.insets=newInsets(10,10,10,1);gridBag,setConstraints(label_aprice,gridBagCon);up.add(label_aprice);gridBagCon=newGridBagConstraints();gridBagCon.gridx=1;gridBagCon.gridy=2;gridBagCon.insets=newInsets(10,1,10,15);text_aprice=newJTextField(15);gridBag,setConstraints(text_aprice,gridBagCon);up.add(text_aprice);label_amount.setFont(newFont("Dialog",0,14));gridBagCon=newGridBagConstraints();gridBagCon.gridx=2;gridBagCon.gridy=2;gridBagCon.insets=newInsets(10,10,10,1);gridBag,setConstraints(label_amount,gridBagCon);up.add(label_amount);gridBagCon=newGridBagConstraints();gridBagCon,gridx=3;gridBagCon,gridy=2;gridBagCon.insets=newInsets(10,1,10,15);text_amount=newJTextField(15);gridBag,setConstraints(text_amount,gridBagCon);up.add(text_amount);gridBag

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论