![JAVA設(shè)計文檔-圖書管理系統(tǒng)_第1頁](http://file4.renrendoc.com/view/b64d255a7fc97729a5787889f6bdf2fd/b64d255a7fc97729a5787889f6bdf2fd1.gif)
![JAVA設(shè)計文檔-圖書管理系統(tǒng)_第2頁](http://file4.renrendoc.com/view/b64d255a7fc97729a5787889f6bdf2fd/b64d255a7fc97729a5787889f6bdf2fd2.gif)
![JAVA設(shè)計文檔-圖書管理系統(tǒng)_第3頁](http://file4.renrendoc.com/view/b64d255a7fc97729a5787889f6bdf2fd/b64d255a7fc97729a5787889f6bdf2fd3.gif)
![JAVA設(shè)計文檔-圖書管理系統(tǒng)_第4頁](http://file4.renrendoc.com/view/b64d255a7fc97729a5787889f6bdf2fd/b64d255a7fc97729a5787889f6bdf2fd4.gif)
![JAVA設(shè)計文檔-圖書管理系統(tǒng)_第5頁](http://file4.renrendoc.com/view/b64d255a7fc97729a5787889f6bdf2fd/b64d255a7fc97729a5787889f6bdf2fd5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)目 錄 TOC o 1-3 h z u 1 緒論1.1課題背景 1.2系統(tǒng)開發(fā)關(guān)鍵技術(shù)介紹2 系統(tǒng)分析2.1 圖書管理工作流程2.2 圖書管理需求3 系統(tǒng)設(shè)計3.1 設(shè)計思想3.2 系統(tǒng)功能結(jié)構(gòu)圖3.3模塊功能設(shè)計 4 系統(tǒng)數(shù)據(jù)庫設(shè)計4.1系統(tǒng)數(shù)據(jù)庫的建立4.2 系統(tǒng)E-R圖 E-R模型分類號紹圖書數(shù)量入庫日期分類號紹圖書數(shù)量入庫日期分類名圖書名稱圖書名稱管理圖書管理圖書用戶名作者用戶名作者借還ISBN碼借還ISBN碼密碼管理人員出版社密碼管理人員出版社姓名讀者有效日期
2、姓名讀者有效日期性別注冊日期性別注冊日期讀者類別讀者單位借閱證號讀者類別讀者單位借閱證號讀者編號4.3 各個數(shù)據(jù)表的創(chuàng)建4.3.1、書籍表(book)列名數(shù)據(jù)類型長度允許為空默認值字段名說明Bannercodevarchar30圖書編號唯一約束Booknamevarchar30圖書名稱自動增長Searchcodevarchar30索書號ISBNunm varchar30ISBN號Kindnumvarchar3分類號kindnamevarchar30分類名positionnumvarchar30排架號publishingcompanyvarchar30出版社publishtimeDate出版日期
3、YYYY-MM_DDstateVarchar4在架狀態(tài)BooknumInt4圖書數(shù)量authorvarchar30作者4.3.2列名數(shù)據(jù)類型長度允許為空默認值字段名說明usernamevarchar30用戶名主鍵,自動增長pswVarchar30密碼4.3.3、列名數(shù)據(jù)類型長度允許為空默認值字段名說明kindnumvarchar30分類號kindbookvarchar30圖書種類4.4 數(shù)據(jù)庫的連接DBAccess.javapackage com.book.Dbconn; import java.sql.Connection;import java.sql.DriverManager;impo
4、rt java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement; public class DBAccess private Connection m_conn; private Statement m_stmt; private String driver = com.microsoft.jdbc.sqlserver.SQLServerDriver; private String url = jdbc:microsoft:sqlserver:/localhost:1433;databasename=bo
5、okmanage; private String uName = sa; private String uPwd = sa; public DBAccess() this.setDriver(driver); this.setConnection(url, uName, uPwd); public DBAccess(String driver, String url, String userName, String userPWD) try m_conn = DriverManager.getConnection(url, userName, userPWD); m_stmt = m_conn
6、.createStatement(); catch (SQLException e) e.printStackTrace(); public boolean setDriver(String driver) try Class.forName(driver); return true; catch (Exception e) e.printStackTrace(); return false; public boolean setConnection(String url, String userName, String userPWD) try m_conn = DriverManager.
7、getConnection(url, userName, userPWD); m_stmt = m_conn.createStatement(); return true; catch (Exception e) e.printStackTrace(); return false; public ResultSet sendQuery(String sql) try ResultSet m_rs = m_stmt.executeQuery(sql); return m_rs; catch (SQLException e) e.printStackTrace(); return null; pu
8、blic int sendUpdate(String sql) try return m_stmt.executeUpdate(sql); catch (SQLException e) e.printStackTrace(); return -1; public static void main(String arg) DBAccess db = new DBAccess(); String sql = select * from book; ResultSet rs = db.sendQuery(sql); try if (rs != null) while (rs.next() Syste
9、m.out.println(rs.getString(Bookname); catch (SQLException e) e.printStackTrace(); 5 系統(tǒng)實現(xiàn)5.1 系統(tǒng)實現(xiàn)工具與支持平臺5.2系統(tǒng)界面及其實現(xiàn)方法1.下面為運行后的界面圖: 實現(xiàn)如下: Mainwin.java public class mainwin private ButtonGroup buttonGroup = new ButtonGroup();private JFrame frame; public static void main(String args) try mainwin window
10、= new mainwin();window.frame.setVisible(true); catch (Exception e) e.printStackTrace();public mainwin() createContents();private void createContents() frame = new JFrame();frame.setTitle(歡迎訪問圖書管理系統(tǒng));frame.getContentPane().setLayout(null);frame.setBounds(100, 100, 700, 500);frame.setDefaultCloseOpera
11、tion(JFrame.EXIT_ON_CLOSE);final JLabel label = new JLabel();label.setForeground(new Color(0, 128, 0);label.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label.setText(用戶名:);label.setBounds(38, 76, 58, 18);frame.getContentPane().add(label);final JTextField textField = new JTextField();textField.setBou
12、nds(92, 75, 92, 20);frame.getContentPane().add(textField);final JLabel label_1 = new JLabel();label_1.setForeground(new Color(0, 128, 0);label_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label_1.setText(密 碼:);label_1.setBounds(225, 76, 59, 18);frame.getContentPane().add(label_1);final JPasswordFie
13、ld passwordField = new JPasswordField();passwordField.setBounds(290, 77, 92, 18);frame.getContentPane().add(passwordField);final JButton button = new JButton();button.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) if(textField.getText().equals() |passwordF
14、ield.getText().equals()JOptionPane.showMessageDialog(null, 請輸入用戶名和密碼!);elseString sql = select count(*) from login where username=+textField.getText()+ and psw=+passwordField.getText()+;DBAccess db = new DBAccess();ResultSet rs = db.sendQuery(sql);try if(rs != null)if(rs.next() & rs.getInt(1)0)Manag
15、eMain manageMain = new ManageMain();manageMain.getFrame().setVisible(true);getFrame().setVisible(false);elseJOptionPane.showMessageDialog(null, 用戶名或密碼錯誤!); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace();finallytry rs.close(); catch (SQLException e) / TODO Auto-generated
16、catch blocke.printStackTrace(););button.setText(登陸);button.setBounds(429, 76, 66, 18);frame.getContentPane().add(button);final JButton button_1 = new JButton();button_1.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) ManagerAdd managerAdd = new ManagerAdd()
17、;managerAdd.getFrame().setVisible(true); getFrame().setVisible(false););button_1.setText(注冊);button_1.setBounds(560, 76, 66, 18);frame.getContentPane().add(button_1);final JRadioButton radioButton = new JRadioButton();radioButton.setForeground(new Color(0, 128, 0);radioButton.setFont(new Font(仿宋_GB2
18、312, Font.PLAIN, 14);radioButton.setText(圖書名稱);buttonGroup.add(radioButton);radioButton.setBounds(35, 125, 84, 26);frame.getContentPane().add(radioButton);final JRadioButton radioButton_1 = new JRadioButton();radioButton_1.setForeground(new Color(0, 128, 0);radioButton_1.setFont(new Font(仿宋_GB2312,
19、Font.PLAIN, 14);buttonGroup.add(radioButton_1);radioButton_1.setText(索引號);radioButton_1.setBounds(141, 125, 77, 26);frame.getContentPane().add(radioButton_1);final JRadioButton radioButton_2 = new JRadioButton();radioButton_2.setForeground(new Color(0, 128, 0);radioButton_2.setFont(new Font(仿宋_GB231
20、2, Font.PLAIN, 14);buttonGroup.add(radioButton_2);radioButton_2.setText(圖書編號);radioButton_2.setBounds(246, 125, 92, 26);frame.getContentPane().add(radioButton_2);final JRadioButton radioButton_3 = new JRadioButton();radioButton_3.setForeground(new Color(0, 128, 0);radioButton_3.setFont(new Font(仿宋_G
21、B2312, Font.PLAIN, 14);buttonGroup.add(radioButton_3);radioButton_3.setText(模糊查詢);radioButton_3.setBounds(352, 125, 92, 26);frame.getContentPane().add(radioButton_3);final JRadioButton radioButton_4 = new JRadioButton();radioButton_4.setForeground(new Color(0, 128, 0);radioButton_4.setFont(new Font(
22、仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_4);radioButton_4.setText(分類名);radioButton_4.setBounds(462, 125, 77, 26);frame.getContentPane().add(radioButton_4);final JRadioButton radioButton_5 = new JRadioButton();radioButton_5.setForeground(new Color(0, 128, 0);radioButton_5.setFont(new Fo
23、nt(仿宋_GB2312, Font.PLAIN, 14);buttonGroup.add(radioButton_5);radioButton_5.setText(出版社);radioButton_5.setBounds(569, 125, 77, 26);frame.getContentPane().add(radioButton_5);final JTextField textField_1 = new JTextField();textField_1.setBounds(45, 162, 270, 22);frame.getContentPane().add(textField_1);
24、final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 0, 255);label_2.setFont(new Font(仿宋_GB2312, Font.PLAIN, 15);label_2.setText(請選擇查詢);label_2.setBounds(25, 105, 84, 18);frame.getContentPane().add(label_2);final JTable table = new JTable();table.setAutoResizeMode(JTable.AUTO_RESIZ
25、E_OFF);table.setName(圖書管理系統(tǒng));table.setBounds(10, 219, 676, 247);frame.getContentPane().add(table);final JLabel label_5 = new JLabel();label_5.setForeground(new Color(255, 0, 255);label_5.setFont(new Font(仿宋_GB2312, Font.PLAIN, 36);label_5.setText(歡迎使用本圖書管理系統(tǒng));label_5.setBounds(133, 9, 406, 60);frame
26、.getContentPane().add(label_5);final JButton button_2 = new JButton();button_2.setAutoscrolls(true);button_2.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) Stringsql = null;if(textField_1.getText().equals()JOptionPane.showMessageDialog(null, 請輸入查詢內(nèi)容!);else
27、if(radioButton.isSelected()sql = select * from book where bookname like %+textField_1.getText()+%;else if(radioButton_1.isSelected()sql = select * from book where searchcode = +textField_1.getText()+;else if(radioButton_2.isSelected()sql = select * from book where bannercode = +textField_1.getText()
28、+;else if(radioButton_3.isSelected()sql = select * from book where bookname like %+textField_1.getText()+%;else if(radioButton_4.isSelected()sql = select * from book where kindname like %+textField_1.getText()+%;else if(radioButton_5.isSelected()sql = select * from book where publishingcompany like
29、%+textField_1.getText()+%;elseJOptionPane.showMessageDialog(null, 請選擇查詢方法!);return;DBAccess db = new DBAccess();ResultSet rs = db.sendQuery(sql);/*/boolean hasRecords;try hasRecords = rs.next(); if (!hasRecords) / 記錄集為空,提示一條消息 JOptionPane.showMessageDialog(table, 無相關(guān)記錄,請檢查輸入!, ,JOptionPane.ERROR_MES
30、SAGE); return; catch (SQLException e) e.printStackTrace();Vector columnHeads = new Vector(); Vector rows = new Vector();/ 用于存儲記錄行 try ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i = rsmd.getColumnCount(); +i) columnHeads.addElement(rsmd.getColumnName(i); do / 獲取記錄集 rows.addElement(get
31、NextRow(rs, rsmd); while (rs.next(); / 建立相應的TableModel,并將TableModel應用到Table中顯示出來 DefaultTableModel model = new DefaultTableModel(rows, columnHeads); table.setModel(model); return; catch (SQLException exc) JOptionPane.showMessageDialog(table, exc.toString(),查詢失??!, JOptionPane.ERROR_MESSAGE); return;
32、);button_2.setText(查詢);button_2.setBounds(532, 162, 92, 22);frame.getContentPane().add(button_2);2.下圖為查詢讀者的信息圖實現(xiàn)代碼如下:UserInfo .javapublic class UserInfo private JFrame frame;public static void main(String args) try UserInfo window = new UserInfo();window.frame.setVisible(true); catch (Exception e) e
33、.printStackTrace();public UserInfo() createContents();private void createContents() frame = new JFrame();frame.getContentPane().setLayout(null);frame.setBounds(100, 100, 700, 500);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);final JLabel label = new JLabel();label.setForeground(new Color(255
34、, 0, 255);label.setFont(new Font(仿宋_GB2312, Font.BOLD, 36);label.setText(查 詢 借 閱 者 信 息);label.setBounds(125, 24, 412, 47);frame.getContentPane().add(label);final JLabel label_7 = new JLabel();label_7.setForeground(new Color(0, 0, 255);label_7.setFont(new Font(仿宋_GB2312, Font.PLAIN, 12);label_7.setTe
35、xt(請輸入借閱證號和姓名);label_7.setBounds(377, 77, 135, 28);frame.getContentPane().add(label_7);final JLabel label_1 = new JLabel();label_1.setForeground(new Color(0, 128, 0);label_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label_1.setText(借閱證號*:);label_1.setBounds(77, 155, 77, 18);frame.getContentPane().
36、add(label_1);final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 128, 0);label_2.setFont(new Font(仿宋_GB2312, Font.PLAIN, 14);label_2.setText(姓 名:);label_2.setBounds(253, 155, 77, 18);frame.getContentPane().add(label_2);final JTextField textField = new JTextField();textField.setBou
37、nds(160, 154, 87, 22);frame.getContentPane().add(textField);final JTextField textField_1 = new JTextField();textField_1.setBounds(323, 154, 87, 22);frame.getContentPane().add(textField_1);final JTable table = new JTable();table.setBounds(39, 233, 616, 223);frame.getContentPane().add(table);final JBu
38、tton button = new JButton();button.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) String sql = select * from reader where readercardnum=+textField.getText()+ or readername = +textField_1.getText()+;DBAccess db = new DBAccess();ResultSet rs = db.sendQuery(s
39、ql);boolean hasRecords;try hasRecords = rs.next(); if (!hasRecords) / 記錄集為空,提示一條消息 JOptionPane.showMessageDialog(table, 無相關(guān)記錄,請檢查輸入!, ,JOptionPane.ERROR_MESSAGE); return; catch (SQLException e) e.printStackTrace();Vector columnHeads = new Vector();/ 用于存儲表頭字段(列名) Vector rows = new Vector();/ 用于存儲記錄行
40、try / 獲取字段的名稱 ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i = rsmd.getColumnCount(); +i) columnHeads.addElement(rsmd.getColumnName(i); do / 獲取記錄集 rows.addElement(getNextRow(rs, rsmd); while (rs.next(); / 建立相應的TableModel,并將TableModel應用到Table中顯示出來 DefaultTableModel model = new DefaultTa
41、bleModel(rows, columnHeads); table.setModel(model); return; catch (SQLException exc) JOptionPane.showMessageDialog(table, exc.toString(),查詢失敗!, JOptionPane.ERROR_MESSAGE); return; );button.setText(查詢);button.setBounds(451, 151, 60, 28);frame.getContentPane().add(button); final JButton button_1 = new
42、 JButton();button_1.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) ManageMain managemain = new ManageMain();managemain.getFrame().setVisible(true); getFrame().setVisible(false););button_1.setText(返回);button_1.setBounds(552, 151, 60, 28);frame.getContentPan
43、e().add(button_1);private static Vector getNextRow(ResultSet rs, ResultSetMetaData rsmd) throws SQLException Vector currentRow = new Vector();for (int i = 1; i = rsmd.getColumnCount(); +i)currentRow.addElement(rs.getString(i);return currentRow; / 返回一條記錄3.管理員注冊界面如下:實現(xiàn)方法如下:ManagerAdd.java public class
44、 ManagerAdd private JPasswordField passwordField_1;private JPasswordField passwordField;private JFrame frame;public static void main(String args) try ManagerAdd window = new ManagerAdd();window.frame.setVisible(true); catch (Exception e) e.printStackTrace();public ManagerAdd() createContents();priva
45、te void createContents() frame = new JFrame();frame.setTitle(管理員注冊);frame.getContentPane().setLayout(null);frame.setBounds(100, 100, 600, 450);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);final JLabel label = new JLabel();label.setForeground(new Color(255, 0, 255);label.setFont(new Font(仿宋_G
46、B2312, Font.PLAIN, 26);label.setText(請?zhí)顚懽孕畔?;label.setBounds(191, 28, 209, 43);frame.getContentPane().add(label);final JLabel label_1 = new JLabel();label_1.setForeground(new Color(0, 128, 0);label_1.setFont(new Font(仿宋_GB2312, Font.PLAIN, 15);label_1.setText(用戶名:);label_1.setBounds(163, 116, 60, 1
47、8);frame.getContentPane().add(label_1);final JTextField textField = new JTextField();textField.setBounds(316, 114, 111, 22);frame.getContentPane().add(textField);final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 128, 0);label_2.setFont(new Font(仿宋_GB2312, Font.PLAIN, 15);label_2.se
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《風化作用與》課件
- 《演講能力培訓》課件
- 復旦大學經(jīng)濟博弈論課件-經(jīng)濟博弈論
- 《MINITAB使用指南》課件
- 《植物的抗凍性》課件
- 《遺傳病的預防》課件
- 主板選購說課稿方案
- 2025高考生物備考說課稿:人體的內(nèi)環(huán)境與穩(wěn)態(tài)說課稿
- 9知法守法 依法維權(quán) 課時3《依法維權(quán)有途徑》(說課稿)-2024-2025學年統(tǒng)編版道德與法治六年級上冊
- 《金算盤流程》課件
- 二零二五年度大型自動化設(shè)備買賣合同模板2篇
- 2024版金礦居間合同協(xié)議書
- GA/T 2145-2024法庭科學涉火案件物證檢驗實驗室建設(shè)技術(shù)規(guī)范
- 2025內(nèi)蒙古匯能煤化工限公司招聘300人高頻重點提升(共500題)附帶答案詳解
- 2025年中國融通資產(chǎn)管理集團限公司春季招聘(511人)高頻重點提升(共500題)附帶答案詳解
- 寵物護理行業(yè)客戶回訪制度構(gòu)建
- 電廠檢修管理
- 《SPIN銷售法課件》課件
- 機動車屬性鑒定申請書
- 2024年中考語文試題分類匯編:非連續(xù)性文本閱讀(學生版)
- 門店禮儀培訓
評論
0/150
提交評論