图书管理系统---java代码import.*;import.*;import.*;import.*;import.*;//---------------------------------------------------------------------------------------------------------classTsgl{ publicstaticvoidmain(Stringargs[]){ dbframedb=newdbframe("图书管理程序"); }}//图书管理系统主界面classdbframeextendsFrameimplementsActionListener{ MenuBardaohang=newMenuBar();//建立菜单栏 Menumfile=newMenu("功能");//建立“功能”菜单组 Menumhelp=newMenu("帮助");//建立“帮助”菜单组 MenuItemmdenglu=newMenuItem("登陆"); MenuItemmchaxun=newMenuItem("查询"); MenuItemmtianjia=newMenuItem("添加"); MenuItemmshanchu=newMenuItem("删除"); MenuItemmexit=newMenuItem("退出"); MenuItemmhelpp=newMenuItem("关于"); Denglupdenglu=newDenglu(); Ptianjiaptianjia=newPtianjia(); Pmainpmain=newPmain(); Pchaxunpchaxun=newPchaxun(); Pshanchupshanchu=newPshanchu(); dbframe(Strings){//在窗口上添加菜单选项 setTitle(s); (mdenglu); (mtianjia); (mchaxun); (mshanchu); (mexit); (mhelpp); (mfile); (mhelp); setMenuBar(daohang); add(pmain); addWindowListener(newWindowAdapter(){ publicvoidwindowClosing(WindowEvente){ (0); } }); setBounds(200,200,340,250); setResizable(false); setVisible(true); (this); (this); (this); (this); (this); (this); validate(); }//窗口事件监听 publicvoidactionPerformed(ActionEvente){ if(()==mexit) (0); if(()==mdenglu){ removeAll(); add(pdenglu); validate(); } if(()==mtianjia){ removeAll(); add(ptianjia); validate(); }//图书添加功能 if(()==mchaxun){ removeAll(); add(pchaxun); validate(); }//图书查询功能 if(()==mshanchu){ removeAll(); add(pshanchu); validate(); }//图书删除功能 if(()==mhelpp){ (this,"欢迎使用图书管理系统","关于本系统", ); } }//各功能菜单事件监听}//classPtianjiaextendsPanelimplementsActionListener{ TextFieldtname,tauthor,tpublish,tdate,tcomment; Labellname,lauthor,lpublish,ldate,lcomment; Buttonbtn; Ptianjia(){ setLayout(null); btn=newButton("添加");//创建“添加”按钮 tname=newTextField(); tauthor=newTextField(); tpublish=newTextField(); tdate=newTextField(); tcomment=newTextField();//创建5个文本框 lname=newLabel("书名"); lauthor=newLabel("作者"); lpublish=newLabel("出版社"); ldate=newLabel("出版日期"); lcomment=newLabel("评论"); a
图书管理系统---java代码模板 来自淘豆网m.daumloan.com转载请标明出处.