收藏 分销(赏)

Java图书标准管理系统附源码.doc

上传人:精**** 文档编号:2993127 上传时间:2024-06-12 格式:DOC 页数:39 大小:479.54KB
下载 相关 举报
Java图书标准管理系统附源码.doc_第1页
第1页 / 共39页
Java图书标准管理系统附源码.doc_第2页
第2页 / 共39页
Java图书标准管理系统附源码.doc_第3页
第3页 / 共39页
Java图书标准管理系统附源码.doc_第4页
第4页 / 共39页
Java图书标准管理系统附源码.doc_第5页
第5页 / 共39页
点击查看更多>>
资源描述

1、目 录题目简述 - 01需求分析 - 01数据结构 - 01功效模块 - 02程序设计 - 02运行截图 - 04分析总结 - 08程序源码 - 08图书信息管理系统题目简述:题目名称:图书信息管理系统要求:使用图形用户界面,用数据库建立1或2个图书信息表,能连接数据库并实现查询、增加、删除、修改等功效。需求分析:图书信息管理系统应该含有图书信息管理功效和流通管理功效。其中,信息管理功效包含查找,增加,修改,删除,显示全部信息等模块。流通管理功效包含图书借阅,归还等模块。所以分别设计各个模块,实现不一样功效。数据结构:用SQL Sever 建立数据库表,用一张表存放图书ID号码,图书名称,图书

2、全部者,图书状态,图书使用者(许可为空)。具体设计以下图所表示:图书ID,图书名称,图书全部者,图书状态,图书使用者(许可为空)均为varchar(50)类型,在Java中能够方便查询。图书存放信息具体内容以下图所表示:功效模块:主程序窗口系统操作图书信息管理图书流通管理 退出增加图书显示图书编辑图书查找图书删除图书图书借阅图书归还程序设计:主框架设计:主框架上方包含三个按钮,分别是“系统管理”、“图书信息管理”和“图书流通管理”,定义JMenuBar类对象、JMenu类对象和JMenuItem类对象,分别表示菜单栏、菜单组和菜单选项,然后调用初始化函数,将不一样类对象经过setText()函

3、数设定不一样文本,然后将其添加到窗口容器中。对每个按钮分别添加不一样消息监听,响应对应消息,调用不一样类完成不一样功效。消息监听功效详见源代码bookMain类。图书信息管理模块包含增加图书,删除图书,编辑图书,查找图书和显示图书信息。具体方法实现在bookBean中实现,当用户点击对应按钮时,消息监听模块就会调用bookBean结构函数产生一个bookBean对象,然后经过对象调用bookBean类中对应方法,完成事件对应。增加图书信息模块:调用bookAdd类结构函数产生一个该类对象,在初始化函数中显示信息输入对话框,提醒用户输入图书ID,图书名称和图书全部者,因为刚增加图书没有被借阅,所

4、以图书状态和图书使用者为默认值,分别为空闲和null,所以用户无须输入这两个属性值。完成输入后,点击确定按钮,消息监听模块将调用bookBean结构函数产生一个该类对象,经过该对象调用bookBeanbookAdd函数,实施SQL语句,经过insert语句完成图书信息增加插入功效。删除图书信息模块:调用bookDel类结构函数产生一个该类对象,在初始化函数中显示信息输入对话框,提醒用户输入要删除图书ID。完成输入后,点击确定按钮,消息监听模块将调用bookBean结构函数产生一个该类对象,经过该对象调用bookBeanbookDel函数,实施删除SQL语句,经过delete语句完成图书信息删除

5、功效。修改图书信息模块:点击按钮后调用bookEdit类结构函数产生一个该类对象,在初始化函数中显示信息输入对话框,提醒用户输入要修改图书ID和其它图书信息,用户将信息输入完成后,点击确定按钮,消息监听模块将调用bookBean结构函数产生一个该类对象,经过该对象调用bookBeanbookEdit函数,实施修改SQL语句,经过update语句完成图书信息编辑功效。查找图书信息模块:点击按钮后调用bookSearch类结构函数产生一个该类对象,在初始化函数中显示信息输入对话框,提醒用户输入要查找图书ID,用户将信息输入完成后,点击确定按钮,消息监听模块将调用bookResult结构函数产生一个

6、该类对象,经过该对象结构函数,实施查找SQL语句,经过select语句完成图书信息查找功效,然后结构图标,将查询到信息显示在图表中。显示图书信息模块:点击按钮后调用bookDisplay类结构函数产生一个该类对象,在该对象结构函数中调用bookAllSearch函数,查询全部图书信息,显示在表格中。 图书流通管理模块包含图书借阅和归还功效,其实就是对数据库中某一统计集某一属性进行修改。图书借阅模块:用户输入要借阅图书名称和本人姓名,点击确定后,将调用bookBean结构函数产生一个对象,经过该对象调用bookBook函数,修改数据库中信息,将图书状态属性变为已借,将图书用户属性变为用户姓名,完

7、成图书借阅功效。图书归还模块:用户输入要归还图书名称,点击确定后,将调用bookBean结构函数产生一个对象,经过该对象调用bookReturn函数,修改数据库中信息,把图书状态置为空闲,将图书用户置为空,从而完成图书归还功效。备注:汇报此部分未附源代码,详见程序源码部分。运行截图:图书信息增加:图书信息修改:图书信息查询:图书信息删除:图书信息显示:图书借阅:图书归还:分析总结:本程序在数据库设计方面能够改为多张表存放方法,用三张表来统计图书信息,借阅关系和学生信息,这么能够降低数据冗余,还能够增加部分其它功效,比图书挂失等功效。因为刚刚接触到Java界面设计,所以本程序在界面设计方面还有有

8、待改善地方。程序源码:DatabaseConn.javapackage bookDB;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class DatabaseConn private Statement stmt = null;ResultSet rs = null;private Connection conn = null;String sql;p

9、ublic DatabaseConn() public void OpenConn() throws Exception tryClass.forName(sun.jdbc.odbc.JdbcOdbcDriver);conn = DriverManager.getConnection(jdbc:odbc:library);catch (Exception e) System.err.println(数据库连接:+e.getMessage();public ResultSet executeQuery(String sql)stmt = null;rs = null;trystmt = conn

10、.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);rs = stmt.executeQuery(sql);catch (SQLException e)System.err.println(查询数据:+e.getMessage();return rs;public void executeUpdate(String sql)stmt = null;rs = null;trystmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITI

11、VE,ResultSet.CONCUR_READ_ONLY);rs = stmt.executeQuery(sql);mit();catch (SQLException e)System.err.println(更新数据:+e.getMessage();public void closeStmt()try stmt.close();catch (SQLException e)System.err.println(释放对象:+e.getMessage();public void closeConn()try conn.close();catch (SQLException ex)System.e

12、rr.println(释放对象:+ex.getMessage();public static String toGBK(String str)tryif(str = null)str = null;elsestr = new String(str.getBytes(ISO-8859-1),GBK);catch (Exception e)System.out.println(e);return str;package bookDB;import java.awt.AWTEvent;import java.awt.BorderLayout;import java.awt.Container;imp

13、ort java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;bookMain.javapublic class bookMai

14、n extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L;/-建立菜单栏-JMenuBar mainMenu = new JMenuBar();/-建立系统管理菜单组- JMenu menuSystem = new JMenu(); JMenuItem itemExit = new JMenuItem(); JMenu menubook = new JMenu(); JMenu menuevent = new JMenu(); JMenuItem itemAdd = new

15、 JMenuItem(); JMenuItem itemEdit = new JMenuItem(); JMenuItem itemDelete = new JMenuItem(); JMenuItem itemSelect = new JMenuItem(); JMenuItem itemBook = new JMenuItem(); JMenuItem itemReturn = new JMenuItem(); JMenuItem itemDisplay = new JMenuItem(); /-创建窗体模板对象- public static bookInfo m_stu = new bo

16、okInfo(); public bookMain() enableEvents(AWTEvent.WINDOW_EVENT_MASK); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); this.setSize(600,480); this.setTitle(图书管理系统); try Init(); catch (Exception e) e.printStackTrace(); private void Init() throws Exception Container contentPane = this

17、.getContentPane(); contentPane.setLayout(new BorderLayout(); /-添加菜单组- menuSystem.setText(系统操作); menuSystem.setFont(new Font(Dialog,0,12); menubook.setText(图书信息管理); menubook.setFont(new Font(Dialog,0,12); menuevent.setText(图书流通管理); menuevent.setFont(new Font(Dialog,0,12); /-生成系统管理菜单组- itemExit.setTex

18、t(退出); itemExit.setFont(new Font(Dialog,0,12); /-生成学生菜单组- itemAdd.setText(增加图书); itemAdd.setFont(new Font(Dialog,0,12); itemEdit.setText(修改信息); itemEdit.setFont(new Font(Dialog,0,12); itemDelete.setText(删除图书); itemDelete.setFont(new Font(Dialog,0,12); itemSelect.setText(查询); itemSelect.setFont(new F

19、ont(Dialog,0,12); itemDisplay.setText(显示全部信息); itemDisplay.setFont(new Font(Dialog,0,12);/-生成管理事务菜单组- itemBook.setText(图书借阅); itemBook.setFont(new Font(Dialog,0,12); itemReturn.setText(图书归还); itemReturn.setFont(new Font(Dialog,0,12); menuSystem.add(itemExit); menubook.add(itemAdd); menubook.add(item

20、Edit); menubook.add(itemDelete); menubook.add(itemSelect); menubook.add(itemDisplay); menuevent.add(itemBook); menuevent.add(itemReturn); /-组合菜单栏- mainMenu.add(menuSystem); mainMenu.add(menubook); mainMenu.add(menuevent); this.setJMenuBar(mainMenu); /添加事件监听 itemExit.addActionListener(this); itemAdd.

21、addActionListener(this); itemEdit.addActionListener(this); itemDelete.addActionListener(this); itemSelect.addActionListener(this); itemBook.addActionListener(this); itemReturn.addActionListener(this); itemDisplay.addActionListener(this); setVisible(true); this.addWindowListener(new WindowAdapter() p

22、ublic void windowClosing(WindowEvent e)System.exit(0); ); public void actionPerformed(ActionEvent e) Object obj = e.getSource(); if(obj = itemExit)System.exit(0); else if(obj = itemAdd) bookAdd asi = new bookAdd(); /asi.downInit(); asi.pack(); asi.setVisible(true); else if(obj = itemEdit) bookEdit e

23、si = new bookEdit(); /esi.downInit(); esi.pack(); esi.setVisible(true); else if(obj = itemDelete) bookDel dsi = new bookDel(); /dsi.downInit(); dsi.pack(); dsi.setVisible(true); else if(obj = itemSelect) bookSearch sbid = new bookSearch(); sbid.pack(); sbid.setVisible(true); else if(obj = itemBook)

24、bookBook sboo = new bookBook(); sboo.pack(); sboo.setVisible(true); else if(obj = itemReturn) bookReturn sre = new bookReturn(); sre.pack(); sre.setVisible(true); else if(obj = itemDisplay) bookDisplay sre = new bookDisplay(); sre.pack(); sre.setVisible(true); public static void main(String args)new

25、 bookMain();bookAdd.javapackage bookDB;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class bookAdd extends JFrame implements ActionListenerContainer c;JLabel jLabel1 = new JLabel();JLabel jLabel2 = new JLabel();JLabel jLabel3 = new JLabel();JLabel jLabel4 = new JLabel();JLabe

26、l jLabel5 = new JLabel();JTextField sid = new JTextField(10);JTextField sname = new JTextField(10);JTextField sowner = new JTextField(10);JTextField sstatus = new JTextField(10);JTextField suser = new JTextField(10);JButton addconfirm = new JButton();public bookAdd()this.setTitle(增加图书信息);this.setRes

27、izable(false);tryInit();catch (Exception e)e.printStackTrace();/设置居中Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation(int)(screenSize.width - 400)/2,(int)(screenSize.height - 300)/2 +45);public void Init() throws Exceptionthis.setSize(300,500);c = this.getContentPan

28、e();c.setLayout(new FlowLayout();jLabel1.setText(图书ID: );jLabel1.setFont(new Font(Dialog,0,12);c.add(jLabel1);sid.setText(null);sid.setFont(new Font(Dialog,0,12);c.add(sid);jLabel2.setText(图书名称: );jLabel2.setFont(new Font(Dialog,0,12);c.add(jLabel2);sname.setText(null);sname.setFont(new Font(Dialog,

29、0,12);c.add(sname);jLabel3.setText(图书全部者: );jLabel3.setFont(new Font(Dialog,0,12);c.add(jLabel3);sowner.setText(null);sowner.setFont(new Font(Dialog,0,12);c.add(sowner);addconfirm.setText(确定增加);addconfirm.setFont(new Font(Dialog,0,12);c.add(addconfirm);addconfirm.addActionListener(this);public void

30、actionPerformed(ActionEvent e)Object obj = e.getSource();if(obj = addconfirm)bookBean rs = new bookBean();rs.bookAdd(sid.getText(),sname.getText(),sowner.getText();this.dispose();bookInfo.javapackage bookDB;public class bookInfo String m_book_id;String m_book_name;String m_book_owner;String m_book_s

31、tatus;String m_book_user;bookEdit.javapackage bookDB;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class bookEdit extends JFrame implements ActionListenerContainer c;JLabel jLabel1 = new JLabel();JLabel jLabel2 = new JLabel();JLabel jLabel3 = new JLabel();JLabel jLabel4 = new

32、 JLabel();JLabel jLabel5 = new JLabel();JTextField sid = new JTextField(10);JTextField sname = new JTextField(10);JTextField sowner = new JTextField(10);JTextField sstatus = new JTextField(10);JTextField suser = new JTextField(10);JButton editconfirm = new JButton();public bookEdit()this.setTitle(修改

33、图书信息);this.setResizable(false);tryInit();catch (Exception e)e.printStackTrace();/设置居中Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation(int)(screenSize.width - 400)/2,(int)(screenSize.height - 300)/2 +45);public void Init() throws Exceptionthis.setSize(300,500);c = t

34、his.getContentPane();c.setLayout(new FlowLayout();jLabel1.setText(要修改图书ID: );jLabel1.setFont(new Font(Dialog,0,12);c.add(jLabel1);sid.setText(null);sid.setFont(new Font(Dialog,0,12);c.add(sid);jLabel2.setText(图书名称: );jLabel2.setFont(new Font(Dialog,0,12);c.add(jLabel2);sname.setText(null);sname.setF

35、ont(new Font(Dialog,0,12);c.add(sname);jLabel3.setText(图书全部者: );jLabel3.setFont(new Font(Dialog,0,12);c.add(jLabel3);sowner.setText(null);sowner.setFont(new Font(Dialog,0,12);c.add(sowner);editconfirm.setText(确定修改);editconfirm.setFont(new Font(Dialog,0,12);c.add(editconfirm);editconfirm.addActionLis

36、tener(this);public void actionPerformed(ActionEvent e)Object obj = e.getSource();if(obj = editconfirm)bookBean rs = new bookBean();rs.bookModify(sid.getText(),sname.getText(),sowner.getText();this.dispose();bookDel.javapackage bookDB;import java.awt.*;import java.awt.event.*;import javax.swing.*;pub

37、lic class bookDel extends JFrame implements ActionListenerContainer c;JLabel jLabel1 = new JLabel();JTextField sid = new JTextField(10);JButton delconfirm = new JButton();public bookDel()this.setTitle(删除图书信息);this.setResizable(false);tryInit();catch (Exception e)e.printStackTrace();/设置居中Dimension sc

38、reenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation(int)(screenSize.width - 400)/2,(int)(screenSize.height - 300)/2 +45);public void Init() throws Exceptionthis.setSize(300,500);c = this.getContentPane();c.setLayout(new FlowLayout();jLabel1.setText(要删除图书ID: );jLabel1.setFont(new

39、Font(Dialog,0,12);c.add(jLabel1);sid.setText(null);sid.setFont(new Font(Dialog,0,12);c.add(sid);delconfirm.setText(确定删除);delconfirm.setFont(new Font(Dialog,0,12);c.add(delconfirm);delconfirm.addActionListener(this);public void actionPerformed(ActionEvent e)Object obj = e.getSource();if(obj = delconf

40、irm)bookBean rs = new bookBean();rs.bookDel(sid.getText();this.dispose();bookDisplay.javapackage bookDB;import java.awt.*;import javax.swing.*;public class bookDisplay extends JFrameJLabel jLabel1 = new JLabel();JButton jBExit = new JButton();JScrollPane jScrollPane1;JTable jTabstuInfo;String sNum;S

41、tring 列名 = 图书ID,图书名,图书全部者,图书状态,使用者;String 列值;String sColValue;String sColName;String sFromValue;String sToValue;public bookDisplay()this.setTitle(学生信息查询结果);/-设置运行位置居中-Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation(int)(screenSize.width - 400)/2,(int)(screenSize.height - 300)/2 +45);bookBean rstu = new bookBean();try列值 = rstu.bookAllSearch();if(列值 = null)JOptionPane.showMessageDialog(null, 没有符合条件统计);th

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 通信科技 > 开发语言

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服