




下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、1錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。錯(cuò) 誤!未定義書(shū)簽。錯(cuò)誤!未定義書(shū)簽。1 緒論 1.1 課題背景1.2 系統(tǒng)開(kāi)發(fā)關(guān)鍵技術(shù)介紹2 系統(tǒng)分析2.1 圖書(shū)管理工作流程2.2 圖書(shū)管理需求3 系統(tǒng)設(shè)計(jì)3.1 設(shè)計(jì)思想3.3 模塊功能設(shè)計(jì)4 系統(tǒng)數(shù)據(jù)庫(kù)設(shè)計(jì)4.1 系統(tǒng)數(shù)據(jù)庫(kù)的建立4.2 系統(tǒng)
2、 E-R 圖 4.3 各個(gè)數(shù)據(jù)表的創(chuàng)建4.4 數(shù)據(jù)庫(kù)的連接5 系統(tǒng)實(shí)現(xiàn)5.1 系統(tǒng)實(shí)現(xiàn)工具與支持平臺(tái)5.2 系統(tǒng)界面及其實(shí)現(xiàn)方法6 總結(jié)與展望6.1 收獲與體會(huì)參考文獻(xiàn)1 緒論1.1 課題背景圖書(shū)管理系統(tǒng)以方便、快捷、費(fèi)用低的優(yōu)點(diǎn)正慢慢地進(jìn)入人們的生活,將傳統(tǒng)的圖書(shū)管理方式徹底地解脫出來(lái),提高效率,減輕工作人員以往繁忙的工作,減小出錯(cuò)的概率,使讀者可以花更多的時(shí)間在選擇書(shū)和看書(shū)上。從而使人們有更多時(shí)間來(lái)獲取信息、了解信息和掌握信息。一個(gè)好的圖書(shū)館不僅僅看它的藏書(shū)的種類(lèi)和數(shù)量是否齊全,還要看它的管理機(jī)制是否健全。本系統(tǒng)根據(jù)圖書(shū)館的日常業(yè)務(wù)運(yùn)作而設(shè)計(jì),更好的管理借書(shū),還書(shū),統(tǒng)計(jì)圖書(shū)類(lèi)別等業(yè)務(wù),系統(tǒng)
3、操作流程與圖書(shū)館的業(yè)務(wù)流程相一致。界面友好、操作容易、維護(hù)簡(jiǎn)單;系統(tǒng)數(shù)據(jù)庫(kù)穩(wěn)定、安全,有圖書(shū)管理業(yè)務(wù)操作知識(shí)的人皆能方便操作。1.2 系統(tǒng)開(kāi)發(fā)關(guān)鍵技術(shù)介紹此模型具有架構(gòu)清晰、模塊獨(dú)立性強(qiáng)、以及易維護(hù)和擴(kuò)展等優(yōu)點(diǎn),采用 Eclipse作為前端開(kāi)發(fā)工具,后臺(tái)用SQL Server 2000實(shí)現(xiàn)數(shù)據(jù)存取,另外還通過(guò)存儲(chǔ)過(guò)程的實(shí)現(xiàn)把一些處理放在數(shù)據(jù)庫(kù)端執(zhí)行,使的數(shù)據(jù)存取效率大大提高,系統(tǒng)的性能也得以提升。通過(guò)Java類(lèi)連接數(shù)據(jù)庫(kù),為各種常用數(shù)據(jù)庫(kù)提供無(wú)縫聯(lián)接的技術(shù)。2 系統(tǒng)分析2.1 圖書(shū)管理工作流程系統(tǒng)完成就圖書(shū)借閱管理的借書(shū)、還書(shū)、操作;書(shū)籍、學(xué)生、借閱記錄的查閱、添加、更新及刪除等功能,此外系統(tǒng)
4、還具備管理員注冊(cè)管理等功能。能更好 。2.2 圖書(shū)管理需求圖書(shū)館要求能隨時(shí)查詢(xún)書(shū)庫(kù)中圖書(shū)的庫(kù)存量,以便及時(shí)準(zhǔn)確、及時(shí)、方便地為讀者提供借閱信息,但不能修改數(shù)據(jù),無(wú)信息處理權(quán),即可以打印清單、瀏覽數(shù)據(jù)等,管理權(quán)限由系統(tǒng)管理員掌握和分配。圖書(shū)管理系統(tǒng)以方便、快捷、費(fèi)用低的優(yōu)點(diǎn)正慢慢地進(jìn)入人們的生活,將傳統(tǒng)的圖書(shū)管理方式徹底的解脫出來(lái),提高效率,減輕工作人員以往繁忙的工作,減小出錯(cuò)的概率,使讀者可以花更多的時(shí)間在選擇書(shū)和看書(shū)上。從而使人們有更多時(shí)間來(lái)獲取信息、了解信息、掌握信息。圖書(shū)館作為提供學(xué)習(xí)的場(chǎng)所,不僅要求便于管理,而且要求對(duì)讀者和借閱者提供方便快速的查找,借閱和登記手續(xù)。3 系統(tǒng)設(shè)計(jì)3.1
5、設(shè)計(jì)思想(1)進(jìn)行合理的需求分析,用Eclips威現(xiàn)前臺(tái)的應(yīng)用程序框架。(2) 詳細(xì)的數(shù)據(jù)庫(kù)系統(tǒng)設(shè)計(jì),用SQL Server 2000實(shí)現(xiàn)數(shù)據(jù)存取。(3) 選擇合理的數(shù)據(jù)庫(kù)連接。3.2 系統(tǒng)功能結(jié)構(gòu)圖3.3 模塊功能設(shè)計(jì)(i)管理員注冊(cè)模塊:填寫(xiě)注冊(cè)的用戶(hù)名和密碼,就可以完成注冊(cè),主要是為了管理的方便,添加 了該模塊。(2)圖書(shū)查詢(xún)模塊:完成以圖書(shū)名稱(chēng),索引號(hào),圖書(shū)編號(hào),模糊查詢(xún),分類(lèi)名,出版社進(jìn)行查詢(xún), 考慮到用戶(hù)的方便性,本查詢(xún),除了索引號(hào)和圖書(shū)編號(hào)進(jìn)行查詢(xún)外,全部采用模 糊查詢(xún)。大大的方便了借閱者的查詢(xún)。(3)讀者查詢(xún)模塊:通過(guò)輸入要查詢(xún)讀者的借閱證號(hào)或者姓名,將符合其一要求的信息查詢(xún)并
6、顯 示在下面的圖標(biāo)中。采用圖標(biāo)顯示的方式,在查到的信息內(nèi)容之上顯示相應(yīng)的數(shù) 據(jù)的標(biāo)題,便于用戶(hù)的理解。4系統(tǒng)數(shù)據(jù)庫(kù)設(shè)計(jì)4.1 系統(tǒng)數(shù)據(jù)庫(kù)的建立該系統(tǒng)采用C/S模式設(shè)計(jì),數(shù)據(jù)庫(kù)部分同應(yīng)用程序一樣起著至關(guān)重要的作用, 因此必須對(duì)數(shù)據(jù)庫(kù)進(jìn)行詳細(xì)的設(shè)計(jì)。該系統(tǒng)使用SQL Server 2000數(shù)據(jù)庫(kù),首先應(yīng)以保證數(shù)據(jù)的獨(dú)立性和一致性 作為出發(fā)點(diǎn),避免數(shù)據(jù)冗余,在設(shè)計(jì)方面,把數(shù)據(jù)庫(kù)分模塊相應(yīng)內(nèi)容存在相應(yīng)的 數(shù)據(jù)庫(kù)中。4.2 系統(tǒng)E-R圖4.3 各個(gè)數(shù)據(jù)表的創(chuàng)建數(shù)據(jù)庫(kù)共有六個(gè)表,分別包括:書(shū)籍表(book),借書(shū)表(borrow),登陸表(login),讀者信息表(reader),圖書(shū)分類(lèi)信息表(inde
7、x ),讀者類(lèi)別表(reader_class )4.3.1、書(shū)籍表(book)列名數(shù)據(jù)類(lèi) 型長(zhǎng) 度允許 為空默認(rèn) 值字段名說(shuō)明Bannercodevarchar30圖書(shū)編號(hào)唯一約束B(niǎo)ooknamevarchar30圖書(shū)名稱(chēng)自動(dòng)增長(zhǎng)Searchcodevarchar30索書(shū)號(hào)ISBNunmvarchar30ISBN 號(hào)Kindnumvarchar3分類(lèi)號(hào)kindnamevarchar30分類(lèi)名positionnumvarchar30排架號(hào)publishingcompanyvarchar30出版社publishtimeDate出版日期YYYY-MM_DDstateVarchar4在架狀態(tài)Bookn
8、umInt4圖書(shū)數(shù)量authorvarchar30作者4.3.2、登陸表(login)列名數(shù)據(jù)類(lèi) 型長(zhǎng) 度允許為 空默認(rèn) 值字段名說(shuō)明usernamevarchar30用戶(hù)名主鍵,自動(dòng) 增長(zhǎng)pswVarchar30密碼4.3.3、圖書(shū)分類(lèi)信息表(index )列名數(shù)據(jù)類(lèi) 型長(zhǎng) 度允許為 空默認(rèn) 值字段名說(shuō)明kindnumvarchar30分類(lèi)號(hào)kindbookvarchar30圖書(shū)種類(lèi)4.4數(shù)據(jù)庫(kù)的連接DBAccess.javapackage com.book.Dbconn;import java.sql.Connection;import java.sql.DriverManager;imp
9、ort java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class DBAccess private Connection m_conn;private Statement m_stmt;privateStringdriver="com.microsoft.jdbc.sqlserver.SQLServerDriver"privateStringurl="jdbc:microsoft:sqlserver:/localhost:1433;databasen
10、ame=bookmanage"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, userNam
11、e, userPWD);m_stmt = m_conn.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
12、 m_conn = DriverManager.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.printStackTrac
13、e(); return null;public 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 != n
14、ull) while (rs.next() System.out.println(rs.getString("Bookname"); catch (SQLException e) e.printStackTrace();5系統(tǒng)實(shí)現(xiàn)1 .1系統(tǒng)實(shí)現(xiàn)工具與支持平臺(tái)(1)用戶(hù)界面本系統(tǒng)采用Eclipse設(shè)計(jì),用戶(hù)交互界面采用的是基于Windows的窗口界面。(2)硬件接口運(yùn)行本系統(tǒng)的硬件基本要求如下:CPU: Intel P4及以上;內(nèi)存:512MB及以上;硬盤(pán):80GB及以上。軟件接口數(shù)據(jù)庫(kù)服務(wù)器:SQL Server 20002 .2系統(tǒng)界面及其實(shí)現(xiàn)方法1 .下面為運(yùn)行后的界
15、面圖實(shí)現(xiàn)如下:Mainwin.java public class mainwin private ButtonGroup buttonGroup = new ButtonGroup();private JFrame frame;public static void main(String args) try mainwin window = new mainwin();window.frame.setVisible(true); catch (Exception e) e.printStackTrace();public mainwin() createContents();private v
16、oid createContents() frame = new JFrame();frame.setTitle("歡迎訪問(wèn)圖書(shū)管理系統(tǒng)");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(0, 128, 0);label.setFont(n
17、ew Font("仿宋 _GB2312”, Font.PLAIN, 14); label.setText("用戶(hù)名:");label.setBounds(38, 76, 58, 18); frame.getContentPane().add(label); final JTextField textField = new JTextField(); textField.setBounds(92, 75, 92, 20);frame.getContentPane().add(textField);final JLabel label_1 = new JLabel()
18、; label_1.setForeground(new Color。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 JPasswordField passwordField = new JPasswordField();passwordField.setBounds(290, 77, 92
19、, 18);frame.getContentPane().add(passwordField);final JButton button = new JButton();button.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) if(textField.getText().equals("")|passwordField.getText().equals("")JOptionPane.showMessageDialog
20、(null,"請(qǐng)輸入用戶(hù) 名和密碼!");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() &
21、;& rs.getInt(1)>0) ManageMain manageMain = new ManageMain();manageMain.getFrame().setVisible(true);getFrame().setVisible(false);elseJOptionPane.showMessageDialog(null,”用戶(hù)名或密碼錯(cuò)誤!"); catch (SQLException e) / TODO Auto-generated catch block e.printStackTrace();finally try rs.close(); catch
22、(SQLException e) / TODO Auto-generated catch block e.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 Acti
23、onEvent arg0) ManagerAdd managerAdd = new ManagerAdd(); managerAdd.getFrame().setVisible(true);getFrame().setVisible(false); );button_1.setText(" 注冊(cè) ");button_1.setBounds(560, 76, 66, 18);frame.getContentPane().add(button_1);final JRadioButton radioButton = new JRadioButton();radioButton.s
24、etForeground(new Color(0, 128, 0);radioButton.setFont(new Font(" 仿宋 _GB2312", Font.PLAIN, 14);radioButton.setText(" 圖書(shū)名稱(chēng)");buttonGroup.add(radioButton);radioButton.setBounds(35, 125, 84, 26);frame.getContentPane().add(radioButton);final JRadioButton radioButton_1 = new JRadioButt
25、on();radioButton_1.setForeground(new Color(0, 128, 0);14);14);radioButton_1.setFont(new Font(" 仿 宋 _GB2312", Font.PLAIN,buttonGroup.add(radioButton_1);radioButton_1.setText(" 索引號(hào) ");radioButton_1.setBounds(141, 125, 77, 26);frame.getContentPane().add(radioButton_1);final JRadioBu
26、tton radioButton_2 = new JRadioButton();radioButton_2.setForeground(new Color(0, 128, 0);radioButton_2.setFont(new Font(" 仿 宋 _GB2312", Font.PLAIN,buttonGroup.add(radioButton_2);radioButton_2.setText(" 圖書(shū)編號(hào)");radioButton_2.setBounds(246, 125, 92, 26);frame.getContentPane().add(ra
27、dioButton_2);final JRadioButton radioButton_3 = new JRadioButton();radioButton_3.setForeground(new Color(0, 128, 0);radioButton_3.setFont(new Font("仿宋 _GB2312”, Font.PLAIN, 14);buttonGroup.add(radioButton_3);radioButton_3.setText("模糊查詢(xún)");radioButton_3.setBounds(352, 125, 92, 26);frame
28、.getContentPane().add(radioButton_3);final JRadioButton radioButton_4 = new JRadioButton();radioButton_4.setForeground(new Color(0, 128, 0);radioButton_4.setFont(new Font("仿宋 _GB2312”, Font.PLAIN, 14);buttonGroup.add(radioButton_4);radioButton_4.setText("分類(lèi)名");radioButton_4.setBounds(
29、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 Font("仿宋 _GB2312”, Font.PLAIN, 14);buttonGroup.add(radioButton_5);radioButton_5.setText("出版社");r
30、adioButton_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);final JLabel label_2 = new JLabel();label_2.setForeground(new Color(0, 0, 255);label_2.se
31、tFont(new Font("仿宋 _GB2312”, Font.PLAIN, 15);label_2.setText("請(qǐng)選擇查詢(xún)");label_2.setBounds(25, 105, 84, 18);frame.getContentPane().add(label_2);final JTable table = new JTable();table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);table.setName("圖書(shū)管理系統(tǒng)");table.setBounds(10, 219, 676
32、, 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("歡迎使用本圖書(shū)管理系統(tǒng)");label_5.setBounds(133, 9, 406, 60);frame.getContentPane().add(label_5);f
33、inal JButton button_2 = new JButton();button_2.setAutoscrolls(true);button_2.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) String sql = null;if(textField_1.getText().equals("")JOptionPane.showMessageDialog(null, "請(qǐng)輸入查詢(xún)內(nèi)容! ");elseif(rad
34、ioButton.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 =
35、"select * from book where bannercode = '"+textField_1.getText()+"'"else if(radioButton_3.isSelected()sql = "select * from book where bookname like '%"+textField_1.getText()+"%'"else if(radioButton_4.isSelected()sql = "select * from book wh
36、ere kindname like '%"+textField_1.getText()+"%'"else if(radioButton_5.isSelected()sql = "select * from book where publishingcompany like '%"+textField_1.getText()+"%'"elseJOptionPane.showMessageDialog(null, "請(qǐng)選擇查詢(xún)方法!");return;DBAccess db =
37、 new DBAccess();ResultSet rs = db.sendQuery(sql);/*/boolean hasRecords;try hasRecords = rs.next();if (!hasRecords) / 記錄集為空,提示一條消息JOptionPane.showMessageDialog(table, "無(wú)相關(guān)記錄,請(qǐng)檢查輸入!", "",JOptionPane.ERROR_MESSAGE);return; catch (SQLException e) e.printStackTrace();Vector<String&
38、gt; columnHeads = new Vector<String>();Vector<Vector> rows = new Vector<Vector>();/ 用于存儲(chǔ)記錄行try ResultSetMetaData rsmd = rs.getMetaData();for (int i = 1; i <= rsmd.getColumnCount(); +i)columnHeads.addElement(rsmd.getColumnName(i);do /獲取記錄集rows.addElement(getNextRow(rs, rsmd); whi
39、le (rs.next();/建立相應(yīng)的 TableModel,并將TableModel應(yīng) 用到Table中顯示出來(lái)DefaultTableModel model = newDefaultTableModel(rows, columnHeads);table.setModel(model);return; catch (SQLException exc) JOptionPane.showMessageDialog(table, exc.toString(),”查詢(xún)失?。?", JOptionPane.ERROR_MESSAGE);return;);button_2.setText(&
40、quot;查詢(xún)");button_2.setBounds(532, 162, 92, 22);frame.getContentPane().add(button_2);一3 .下圖為查詢(xún)讀者的信息圖實(shí)現(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.print
41、StackTrace();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, 0,
42、255);label.setFont(new Font(" 仿宋 _GB2312", Font.BOLD, 36);label.setText(" 查 詢(xún) 借 閱 者 信 息 ");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
43、", Font.PLAIN, 12);label_7.setText(" 請(qǐng)輸入借閱證號(hào)和姓名");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(&q
44、uot; 借閱證號(hào)*: ");label_1.setBounds(77, 155, 77, 18);frame.getContentPane().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,
45、77, 18);frame.getContentPane().add(label_2);final JTextField textField = new JTextField();textField.setBounds(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
46、JTable table = new JTable();table.setBounds(39, 233, 616, 223);frame.getContentPane().add(table);final JButton button = new JButton();button.addActionListener(new ActionListener() public void actionPerformed(final ActionEvent arg0) String sql = "select * from reader where readercardnum="
47、39;+textField.getText()+”'or readername =”'+textField_1.getText()+"”'DBAccess db = new DBAccess();ResultSet rs = db.sendQuery(sql); boolean hasRecords;try hasRecords = rs.next(); if (!hasRecords) /記錄集為空,提示一條消息JOptionPane.showMessageDialog(table,"無(wú)相關(guān) 記錄,請(qǐng)檢查輸入匚”",JOptionPane
48、.ERROR_MESSAGE);return; catch (SQLException e) e.printStackTrace();Vector<String> columnHeads = new Vector<String>();/用于存儲(chǔ)表頭字段(列名)Vector<Vector> rows = new Vector<Vector>();/ 用于存儲(chǔ) 記錄行try /獲取字段的名稱(chēng)ResultSetMetaData rsmd = rs.getMetaData();for (int i = 1; i <= rsmd.getColumnC
49、ount(); +i)columnHeads.addElement(rsmd.getColumnName(i);do /獲取記錄集 rows.addElement(getNextRow(rs, rsmd); while (rs.next();/建立相應(yīng)的 TableModel,并將TableModel應(yīng)用至U Table中顯示出來(lái)DefaultTableModel model = new DefaultTableModel(rows, columnHeads); table.setModel(model); return; catch (SQLException exc) JOptionPan
50、e.showMessageDialog(table, exc.toString(),”查詢(xún)失??! ", JOptionPane.ERROR_MESSAGE);return; ); button.setText("查詢(xún)"); button.setBounds(451, 151,60, 28);frame.getContentPane().add(button);final JButton button_1 = new JButton();button_1.addActionListener(new ActionListener() public void actio
51、nPerformed(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.getContentPane().add(button_1);一private static Vector getNextRow(ResultSet rs,
52、 ResultSetMetaData rsmd) throws SQLException Vector<String> currentRow = new Vector<String>();for (int i = 1; i <= rsmd.getColumnCount(); +i)currentRow.addElement(rs.getString(i);return currentRow; / 返回一條記錄4 .管理員注冊(cè)界面如下:實(shí)現(xiàn)方法如下:ManagerAdd.javapublic class ManagerAdd private JPasswordFie
53、ld 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();private void createContents() frame
54、= new JFrame();frame.setTitle("管理員注冊(cè)");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("仿宋 _GB2312”, Fon
55、t.PLAIN, 26);label.setText("請(qǐng)?zhí)顚?xiě)注冊(cè)信息"力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("用戶(hù)名:");label_1.setBo
56、unds(163, 116, 60, 18);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("仿宋 _GB231
57、2", Font.PLAIN, 15);label_2.setText("密碼:");label_2.setBounds(163, 196, 65, 18);frame.getContentPane().add(label_2);final JPasswordField passwordField = new JPasswordField();passwordField.setBounds(315, 194, 112, 22);frame.getContentPane().add(passwordField);final JLabel label_3 = new JLabel();label_3.setForeground(new Color(0, 128, 0);label_3.setFont(new Font("仿宋 _GB2312", Font.PLAIN,
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 消防安全生產(chǎn)合同責(zé)任狀
- 合同范本:?jiǎn)挝欢ㄆ诖鎲钨|(zhì)押貸款
- 度勞動(dòng)和社會(huì)保障合同代理協(xié)議
- 債權(quán)資產(chǎn)買(mǎi)賣(mài)合同
- 度標(biāo)準(zhǔn)工廠租賃合同
- 雇傭勞動(dòng)合同模板合同
- 股票基金權(quán)益分配合同范本
- 寵物收養(yǎng)家庭寵物養(yǎng)護(hù)與寵物友好公共設(shè)施考核試卷
- 地震勘探儀器在復(fù)雜地質(zhì)條件下的應(yīng)用考核試卷
- 鉛筆筆芯安全課件下載
- 2025年全國(guó)高考體育單招政治時(shí)事填空練習(xí)50題(含答案)
- 2025教科版一年級(jí)科學(xué)下冊(cè)教學(xué)計(jì)劃
- 中華人民共和國(guó)學(xué)前教育法-知識(shí)培訓(xùn)
- 2023年新高考(新課標(biāo))全國(guó)2卷數(shù)學(xué)試題真題(含答案解析)
- 事業(yè)單位工作人員獎(jiǎng)勵(lì)審批表
- 山東省技能大賽青島選拔賽-世賽選拔項(xiàng)目52樣題(平面設(shè)計(jì)技術(shù))
- 城市社會(huì)學(xué)課件
- 人教版六年級(jí)美術(shù)下冊(cè)全冊(cè)課件【完整版】
- GB/T 9788-1988熱軋不等邊角鋼尺寸、外形、重量及允許偏差
- 教科版三年級(jí)下冊(cè)科學(xué)全冊(cè)完整課件
- 護(hù)理工作質(zhì)量標(biāo)準(zhǔn)及考核細(xì)則
評(píng)論
0/150
提交評(píng)論