欢迎来到天天文库
浏览记录
ID:37551979
大小:51.00 KB
页数:10页
时间:2019-05-25
《图书管理系统---java代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjava.util.*;importjavax.swing.*;//---------------------------------------------------------------------------------------------------------classTsgl{publicstaticvoidmain(Stringargs[]){dbframe
2、db=newdbframe("图书管理程序");}}//图书管理系统主界面classdbframeextendsFrameimplementsActionListener{MenuBardaohang=newMenuBar();//建立菜单栏Menumfile=newMenu("功能");//建立“功能”菜单组Menumhelp=newMenu("帮助");//建立“帮助”菜单组MenuItemmdenglu=newMenuItem("登陆");MenuItemmchaxun=newMenuItem("查
3、询");MenuItemmtianjia=newMenuItem("添加");MenuItemmshanchu=newMenuItem("删除");MenuItemmexit=newMenuItem("退出");MenuItemmhelpp=newMenuItem("关于");Denglupdenglu=newDenglu();Ptianjiaptianjia=newPtianjia();Pmainpmain=newPmain();Pchaxunpchaxun=newPchaxun();Pshanchup
4、shanchu=newPshanchu();dbframe(Strings){//在窗口上添加菜单选项..setTitle(s);mfile.add(mdenglu);mfile.add(mtianjia);mfile.add(mchaxun);mfile.add(mshanchu);mfile.add(mexit);mhelp.add(mhelpp);daohang.add(mfile);daohang.add(mhelp);setMenuBar(daohang);add(pmain);addWindo
5、wListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});setBounds(200,200,340,250);setResizable(false);setVisible(true);mexit.addActionListener(this);mdenglu.addActionListener(this);mtianjia.addActionListener(this);mchaxun.ad
6、dActionListener(this);mshanchu.addActionListener(this);mhelpp.addActionListener(this);validate();}//窗口事件监听publicvoidactionPerformed(ActionEvente){if(e.getSource()==mexit)System.exit(0);if(e.getSource()==mdenglu){removeAll();add(pdenglu);validate();}if(e.g
7、etSource()==mtianjia){removeAll();add(ptianjia);validate();}//图书添加功能if(e.getSource()==mchaxun){removeAll();add(pchaxun);..validate();}//图书查询功能if(e.getSource()==mshanchu){removeAll();add(pshanchu);validate();}//图书删除功能if(e.getSource()==mhelpp){JOptionPane.s
8、howMessageDialog(this,"欢迎使用图书管理系统","关于本系统",JOptionPane.INFORMATION_MESSAGE);}}//各功能菜单事件监听}//classPtianjiaextendsPanelimplementsActionListener{TextFieldtname,tauthor,tpublish,tdate,tcomment;Labellname,lauthor,lpublis
此文档下载收益归作者所有