欢迎来到天天文库
浏览记录
ID:37104038
大小:51.00 KB
页数:10页
时间:2019-05-17
《图书管理系统___java代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、专业资料importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjava.util.*;importjavax.swing.*;//---------------------------------------------------------------------------------------------------------classTsgl{publicstaticvoidmain(Stringargs[]){dbframedb=newdbf
2、rame("图书管理程序");}}//图书管理系统主界面classdbframeextendsFrameimplementsActionListener{MenuBardaohang=newMenuBar();//建立菜单栏Menumfile=newMenu("功能");//建立“功能”菜单组Menumhelp=newMenu("帮助");//建立“帮助”菜单组MenuItemmdenglu=newMenuItem("登陆");MenuItemmchaxun=newMenuItem("查询");MenuItemmtianjia=
3、newMenuItem("添加");MenuItemmshanchu=newMenuItem("删除");MenuItemmexit=newMenuItem("退出");MenuItemmhelpp=newMenuItem("关于");Denglupdenglu=newDenglu();Ptianjiaptianjia=newPtianjia();Pmainpmain=newPmain();Pchaxunpchaxun=newPchaxun();Pshanchupshanchu=newPshanchu();dbframe(Str
4、ings){//在窗口上添加菜单选项word完美格式专业资料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);addWindowListener(newWindowAdapter(){public
5、voidwindowClosing(WindowEvente){System.exit(0);}});setBounds(200,200,340,250);setResizable(false);setVisible(true);mexit.addActionListener(this);mdenglu.addActionListener(this);mtianjia.addActionListener(this);mchaxun.addActionListener(this);mshanchu.addActionListene
6、r(this);mhelpp.addActionListener(this);validate();}//窗口事件监听publicvoidactionPerformed(ActionEvente){if(e.getSource()==mexit)System.exit(0);if(e.getSource()==mdenglu){removeAll();add(pdenglu);validate();}if(e.getSource()==mtianjia){removeAll();add(ptianjia);validate();
7、}//图书添加功能if(e.getSource()==mchaxun){removeAll();add(pchaxun);word完美格式专业资料validate();}//图书查询功能if(e.getSource()==mshanchu){removeAll();add(pshanchu);validate();}//图书删除功能if(e.getSource()==mhelpp){JOptionPane.showMessageDialog(this,"欢迎使用图书管理系统","关于本系统",JOptionPane.INFORM
8、ATION_MESSAGE);}}//各功能菜单事件监听}//classPtianjiaextendsPanelimplementsActionListener{TextFieldtname,tauthor,tpublish,tdate,tcomment;Lab
此文档下载收益归作者所有