圖書館管理系統(tǒng).doc_第1頁
圖書館管理系統(tǒng).doc_第2頁
圖書館管理系統(tǒng).doc_第3頁
圖書館管理系統(tǒng).doc_第4頁
圖書館管理系統(tǒng).doc_第5頁
已閱讀5頁,還剩21頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

package abc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.SQLException;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;import java.sql.*;class BookAddFrame extends JFrame /添加書籍private ConnectionDB myCon=new ConnectionDB();private JButton YesBtn,NoBtn;private static JTextField bookNo,bookName,bookPress,bookPrice,bookWriter,bookPosition,bookRemain;/空白區(qū)private JLabel bookNoLabel,bookNameLabel,bookPressLabel,bookPriceLabel,bookWriterLabel,bookPositionLabel,bookRemainLabel;/提示區(qū)private static Font font=new Font(楷體,Font.BOLD,14);public BookAddFrame()this.setTitle(添加書籍);this.setSize(400,600);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getbookName();this.add(getbookNo();this.add(getbookPress();this.add(getbookPrice();this.add(getbookWriter();this.add(getbookPosition();this.add(getbookRemain();private void addCompnents()bookNameLabel=new JLabel(書 名:);bookNameLabel.setFont(font);bookNameLabel.setBounds(100, 10, 60, 20);this.add(bookNameLabel);bookNoLabel=new JLabel(書 號:);bookNoLabel.setFont(font);bookNoLabel.setBounds(100, 50, 60, 20);this.add(bookNoLabel);bookPressLabel=new JLabel(出版社:);bookPressLabel.setFont(font);bookPressLabel.setBounds(100, 90, 60, 20);this.add(bookPressLabel);bookPriceLabel=new JLabel(價 格:);bookPriceLabel.setFont(font);bookPriceLabel.setBounds(100, 130, 60, 20);this.add(bookPriceLabel);bookWriterLabel=new JLabel(作 者:);bookWriterLabel.setFont(font);bookWriterLabel.setBounds(100, 170, 60, 20);this.add(bookWriterLabel);bookPositionLabel=new JLabel(位 置:);bookPositionLabel.setFont(font);bookPositionLabel.setBounds(100, 210, 60, 20);this.add(bookPositionLabel);bookRemainLabel=new JLabel(進(jìn)貨量:);bookRemainLabel.setFont(font);bookRemainLabel.setBounds(100, 250, 60, 20);this.add(bookRemainLabel);YesBtn = new JButton(確定);YesBtn.setFont(font);YesBtn.setBounds(130,300,80, 30);this.add(YesBtn);NoBtn = new JButton(取消);NoBtn.setFont(font);NoBtn.setBounds(220,300,80, 30);this.add(NoBtn);YesBtn.addActionListener(new ActionListener() /添加確認(rèn)按鈕響應(yīng)Overridepublic void actionPerformed(ActionEvent e)/ TODO 自動生成的方法存根String sql=insert into Book(bookNo,bookName,bookPress,bookPrice,bookWriter,bookPosition,bookRemain)values(+bookNo.getText()+,+bookName.getText()+,+bookPress.getText()+,+bookPrice.getText()+,+bookWriter.getText()+,+bookPosition.getText()+,+bookRemain.getText()+); try myCon.getStatement().executeUpdate(sql);myCon.breakDB(); catch (SQLException e1) e1.printStackTrace(); MFrame frame=new MFrame(); dispose(); );NoBtn.addActionListener(new ActionListener() Override public void actionPerformed(ActionEvent e) / TODO 自動生成的方法存根 MFrame frame=new MFrame(); dispose(); ); public static JTextField getbookName() if(bookName=null)bookName=new JTextField();bookName.setBounds(155,10,150,20);bookName.setFont(font);bookName.setForeground(Color.blue);return bookName;public static JTextField getbookNo() if(bookNo=null)bookNo=new JTextField();bookNo.setFont(font);bookNo.setBounds(155,50,150,20);bookNo.setForeground(Color.blue);return bookNo; public static JTextField getbookPress() if(bookPress=null)bookPress=new JTextField();bookPress.setFont(font);bookPress.setBounds(155,90,150,20);bookPress.setForeground(Color.blue);return bookPress;public static JTextField getbookPrice() if(bookPrice=null)bookPrice=new JTextField();bookPrice.setFont(font);bookPrice.setBounds(155,130,150,20);bookPrice.setForeground(Color.blue);return bookPrice;public static JTextField getbookWriter() if(bookWriter=null)bookWriter=new JTextField();bookWriter.setFont(font);bookWriter.setBounds(155,170,150,20);bookWriter.setForeground(Color.blue);return bookWriter;public static JTextField getbookPosition() if(bookPosition=null)bookPosition=new JTextField();bookPosition.setFont(font);bookPosition.setBounds(155,210,150,20);bookPosition.setForeground(Color.blue);return bookPosition;public static JTextField getbookRemain() if(bookRemain=null)bookRemain=new JTextField();bookRemain.setFont(font);bookRemain.setBounds(155,250,150,20);bookRemain.setForeground(Color.blue);return bookRemain;/public void setFrame(LoginFrame frame)/this.frame1=frame;/package abc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;import java.sql.*;class BookSERFrame extends JFrame /修改書籍private ConnectionDB myCon=new ConnectionDB();private JButton YesBtn,NoBtn;private static JTextField bookName,bookNo,bookPress,bookPrice,bookWriter,bookPosition,bookRemain;/空白區(qū)private JLabel bookNameLabel,bookNoLabel,bookPressLabel,bookPriceLabel,bookWriterLabel,bookPositionLabel,bookRemainLabel;/提示區(qū)private static Font font=new Font(楷體,Font.BOLD,14);public BookSERFrame()this.setTitle(修改書籍);this.setSize(400,600);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getbookName();this.add(getbookNo();this.add(getbookPress();this.add(getbookPrice();this.add(getbookWriter();this.add(getbookPosition();this.add(getbookRemain();private void addCompnents()bookNoLabel=new JLabel(書 號:);bookNoLabel.setFont(font);bookNoLabel.setBounds(100, 10, 60, 20);this.add(bookNoLabel);bookNameLabel=new JLabel(書 名:);bookNameLabel.setFont(font);bookNameLabel.setBounds(100, 120, 60, 20);this.add(bookNameLabel);bookPressLabel=new JLabel(出版社:);bookPressLabel.setFont(font);bookPressLabel.setBounds(95, 160, 60, 20);this.add(bookPressLabel);bookPriceLabel=new JLabel(價 格:);bookPriceLabel.setFont(font);bookPriceLabel.setBounds(100, 200, 60, 20);this.add(bookPriceLabel);bookWriterLabel=new JLabel(作 者:);bookWriterLabel.setFont(font);bookWriterLabel.setBounds(100, 240, 60, 20);this.add(bookWriterLabel);bookPositionLabel=new JLabel(位 置:);bookPositionLabel.setFont(font);bookPositionLabel.setBounds(100, 280, 60, 20);this.add(bookPositionLabel); bookRemainLabel=new JLabel(庫 存:);bookRemainLabel.setFont(font);bookRemainLabel.setBounds(100, 320, 60, 20);this.add(bookRemainLabel);YesBtn = new JButton(確定);YesBtn.setFont(font);YesBtn.setBounds(130,50,80, 30);this.add(YesBtn);NoBtn = new JButton(取消);NoBtn.setFont(font);NoBtn.setBounds(220,50,80, 30);this.add(NoBtn);YesBtn.addActionListener(new ActionListener() /添加確認(rèn)按鈕響應(yīng)Overridepublic void actionPerformed(ActionEvent e)/ TODO 自動生成的方法存根/bookName,bookNo,bookPress,bookPrice,bookWriter,bookPosition,bookRemain String sql=select * from Book where bookNo=+bookNo.getText()+; try myCon.getStatement().executeUpdate(sql); myCon.breakDB(); catch (SQLException e1) e1.printStackTrace(); );NoBtn.addActionListener(new ActionListener() Override public void actionPerformed(ActionEvent e) / TODO 自動生成的方法存根 MFrame frame=new MFrame(); dispose(); ); public static JTextField getbookNo() if(bookNo=null)bookNo=new JTextField();bookNo.setFont(font);bookNo.setBounds(150,10,150,20);bookNo.setForeground(Color.blue);return bookNo; public static JTextField getbookName() if(bookName=null)bookName=new JTextField();bookName.setBounds(150,120,150,20);bookName.setFont(font);bookName.setForeground(Color.blue);return bookName; public static JTextField getbookPress() if(bookPress=null)bookPress=new JTextField();bookPress.setFont(font);bookPress.setBounds(150,160,150,20);bookPress.setForeground(Color.blue);return bookPress;public static JTextField getbookPrice() if(bookPrice=null)bookPrice=new JTextField();bookPrice.setFont(font);bookPrice.setBounds(150,200,150,20);bookPrice.setForeground(Color.blue);return bookPrice;public static JTextField getbookWriter() if(bookWriter=null)bookWriter=new JTextField();bookWriter.setFont(font);bookWriter.setBounds(150,240,150,20);bookWriter.setForeground(Color.blue);return bookWriter;public static JTextField getbookPosition() if(bookPosition=null)bookPosition=new JTextField();bookPosition.setFont(font);bookPosition.setBounds(150,280,150,20);bookPosition.setForeground(Color.blue);return bookPosition;public static JTextField getbookRemain() if(bookRemain=null)bookRemain=new JTextField();bookRemain.setFont(font);bookRemain.setBounds(150,320,150,20);bookRemain.setForeground(Color.blue);return bookRemain;/public void setFrame(LoginFrame frame)/this.frame1=frame;/package abc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.SQLException;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;import java.sql.*;class BorrowFrame extends JFrame /借書private ConnectionDB myCon=new ConnectionDB();private JButton YesBtn,NoBtn;private static JTextField readNo,bookNo;/空白區(qū)private JLabel readNoLabel,bookNoLabel;/提示區(qū)private static Font font=new Font(楷體,Font.BOLD,14);public BorrowFrame()this.setTitle(借閱書籍);this.setSize(400,400);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getreadNo();this.add(getbookNo();private void addCompnents()readNoLabel=new JLabel(借閱號:);readNoLabel.setFont(font);readNoLabel.setBounds(95, 10, 60, 20);this.add(readNoLabel);bookNoLabel=new JLabel(書編號:);bookNoLabel.setFont(font);bookNoLabel.setBounds(100, 50, 60, 20);this.add(bookNoLabel);YesBtn = new JButton(確定);YesBtn.setFont(font);YesBtn.setBounds(130,150,80, 30);this.add(YesBtn);NoBtn = new JButton(取消);NoBtn.setFont(font);NoBtn.setBounds(220,150,80, 30);this.add(NoBtn);YesBtn.addActionListener(new ActionListener() /添加確認(rèn)按鈕響應(yīng)Overridepublic void actionPerformed(ActionEvent e)/ TODO 自動生成的方法存根String sql=insert into Borrow(readNo,bookNo)values(+readNo.getText()+, +bookNo.getText()+); try myCon.getStatement().executeUpdate(sql);myCon.breakDB(); catch (SQLException e1) e1.printStackTrace();); public static JTextField getreadNo() if(readNo=null)readNo=new JTextField();readNo.setBounds(155,10,150,20);readNo.setFont(font);readNo.setForeground(Color.blue);return readNo;public static JTextField getbookNo() if(bookNo=null)bookNo=new JTextField();bookNo.setFont(font);bookNo.setBounds(155,50,150,20);bookNo.setForeground(Color.blue);return bookNo;package abc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class ConnectionDB private String JDriver=sun.jdbc.odbc.JdbcOdbcDriver;private String sqlURL=jdbc:odbc:library;/private String JDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver;/private String sqlURL=jdbc:sqlserver:/localhost:1433;DatabaseName=MyTest;integratedSecurity=TRUE;private Connection connection;private Statement statement;private String tableSQL=new String4;public ConnectionDB()try Class.forName(JDriver);connection=DriverManager.getConnection(sqlURL);statement=connection.createStatement(); catch (ClassNotFoundException e) e.printStackTrace();catch (SQLException e) e.printStackTrace();public Connection getConnection()return connection;public Statement getStatement()return statement;public void breakDB()try statement.close();connection.close(); catch (SQLException e) e.printStackTrace();public void createTable()tableSQL0=create table Book(+ bookNo int primary key,+ bookName varchar(20),+ bookPress varchar(20),+ bookPrice int,+ bookWriter varchar(20),+ bookPosition varchar(20),+ bookRemain int);/*tableSQL1=create table pz_info(+ arrive_hour char(2),+ arrive_minute char(2),+ leave_hour char(2),+ leave_minute char(2),+ everyday_time char(2);tableSQL2=create table everymonth_statistics(+ Sno char(9) not null,+ Sname char(10) not null,+ remain_time char(4),+ late_times smallint,+ early_leave smallint,+ work_day smallint,+ primary key(Sno),+ foreign key(Sno)+ references staff_info(Sno) on delete cascade);tableSQL3=create table everyday_statistics(+ Sno char(9) not null,+ Sname char(10) not null,+ hour char(2),+ minute char(2),+ action char(6),+ time char(4),+ primary key(Sno),+ foreign key(Sno)+ references staff_info(Sno) on delete cascade);*/ try for(int i=0;i1;i+)statement.executeUpdate(tableSQLi); catch (SQLException e) e.printStackTrace();package abc;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.SQLException;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;import java.sql.*;class LendFrame extends JFrame /還書private ConnectionDB myCon=new ConnectionDB();private JButton YesBtn,NoBtn;private static JTextField readNo,bookNo;/空白區(qū)private JLabel readNoLabel,bookNoLabel;/提示區(qū)private static Font font=new Font(楷體,Font.BOLD,14);public LendFrame()this.setTitle(歸還書籍);this.setSize(400,600);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getreadNo();this.add(getbookNo();private void addCompnents()readNoLabel=new JLabel(借閱號:);readNoLabel.setFont(font);readNoLabel.setBounds(100, 10, 60, 20);this.add(readNoLabel);bookNoLabel=new JLabel(書編號:);bookNoLabel.setFont(font);bookNoLabel.setBounds(100, 50, 60, 20);this.add(bookNoLabel);YesBtn = new JButton(確定);YesBtn.setFont(font);YesBtn.setBounds(130,180,80, 30);this.add(YesBtn);NoBtn = new JButton(取消);NoBtn.setFont(font);NoBtn.setBounds(220,180,80, 30);this.add(NoBtn);YesBtn.addActionListener(new ActionListener() /添加確認(rèn)按鈕響應(yīng)Overridepublic void actionPerformed(ActionEvent e)/ TODO 自動生成的方法存根String sql1=insert into Lend(readNo,bookNo)values(+readNo.getText()+, +bookNo.getText()+); try myCon.getStatement().executeUpdate(sql1);myCon.breakDB(); catch (SQLException e1) e1.printStackTrace(); String sql2=delete from Borrow where readNo=+readNo.getText()+; try myCon.getStatement().executeUpdate(sql2);myCon.breakDB(); catch (SQLException e1) e1.printStackTrace(); String sql3=delete from Lend where readNo=+readNo.getText()+; try myCon.getStatement().executeUpdate(sql3);myCon.breakDB(); catch (SQLException e1) e1.printStackTrace(); dispose(););NoBtn.addActionListener(new ActionListener() /添加確認(rèn)按鈕響應(yīng)Overridepublic void actionPerformed(ActionEvent e)dispose();); public static JTextField getreadNo() if(readNo=null)readNo=new JTextField();readNo.setBounds(155,10,150,20);readNo.setFont(font);readNo.setForeground(Color.blue);return readNo;public stat

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論