⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 borrow.java

📁 比较完整功能全面的图书管理系统;
💻 JAVA
字号:
package bookmanager;import javax.swing.*;import java.awt.*;import com.borland.jbcl.layout.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class borrow extends JFrame {    private DBManager db =new DBManager();      //dbmanager  XYLayout xYLayout1 = new XYLayout();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  JLabel jLabel3 = new JLabel();  JTextField jTextstudentname = new JTextField();  JTextField jTextbookname = new JTextField();  JTextField jTextborrowdate = new JTextField();  JButton jButtonOk = new JButton();  JButton jButtonCancel = new JButton();  JLabel jLabel4 = new JLabel();  JTextField jTextcomment = new JTextField();  JButton jButtonReset = new JButton();  public borrow() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  public static void main(String[] args) {    borrow borrow = new borrow();  }  private void jbInit() throws Exception {    jLabel1.setFont(new java.awt.Font("Dialog", 0, 16));    jLabel1.setRequestFocusEnabled(true);    jLabel1.setText("借阅者姓名");    this.getContentPane().setLayout(xYLayout1);    jLabel2.setFont(new java.awt.Font("Dialog", 0, 16));    jLabel2.setText("书名");    jLabel3.setFont(new java.awt.Font("Dialog", 0, 16));    jLabel3.setText("日期");    jTextborrowdate.setFont(new java.awt.Font("Dialog", 0, 16));    jTextborrowdate.setText("");    jTextbookname.setFont(new java.awt.Font("Dialog", 0, 16));    jTextbookname.setText("");    jTextstudentname.setFont(new java.awt.Font("Dialog", 0, 16));    jTextstudentname.setText("");    jButtonOk.setFont(new java.awt.Font("Dialog", 0, 16));    jButtonOk.setText("确定");    jButtonOk.addMouseListener(new borrow_jButtonOk_mouseAdapter(this));    jButtonCancel.setFont(new java.awt.Font("Dialog", 0, 16));    jButtonCancel.setText("取消");    jButtonCancel.addMouseListener(new borrow_jButtonCancel_mouseAdapter(this));    xYLayout1.setWidth(437);    xYLayout1.setHeight(276);    this.setTitle("Borrow Book");    jLabel4.setFont(new java.awt.Font("Dialog", 0, 16));    jLabel4.setText("备注");    jTextcomment.setFont(new java.awt.Font("Dialog", 0, 16));    jTextcomment.setText("");    jButtonReset.setEnabled(true);    jButtonReset.setFont(new java.awt.Font("Dialog", 0, 16));    jButtonReset.setText("清空");     jButtonReset.addMouseListener(new borrow_jButtonReset_mouseAdapter(this));    this.getContentPane().add(jTextstudentname,   new XYConstraints(170, 27, 150, 26));    this.getContentPane().add(jTextbookname, new XYConstraints(169, 81, 154, 23));    this.getContentPane().add(jTextborrowdate,  new XYConstraints(169, 124, 153, -1));    this.getContentPane().add(jTextcomment,  new XYConstraints(170, 173, 154, -1));    this.getContentPane().add(jButtonOk,  new XYConstraints(170, 225, 101, -1));    this.getContentPane().add(jButtonReset,  new XYConstraints(37, 227, 104, 32));    this.getContentPane().add(jLabel1, new XYConstraints(42, 23, 88, 33));    this.getContentPane().add(jLabel4, new XYConstraints(41, 184, 63, 29));    this.getContentPane().add(jLabel2,  new XYConstraints(39, 81, 89, 35));    this.getContentPane().add(jButtonCancel, new XYConstraints(296, 226, 100, -1));    this.getContentPane().add(jLabel3,   new XYConstraints(39, 137, 87, 29));        this.setSize(500,350);  }  void jButtonReset_mouseClicked(MouseEvent e) {           jTextborrowdate.setText("");           jTextbookname.setText("");           jTextstudentname.setText("");           jTextcomment.setText("");  }  void jButtonCancel_mouseClicked(MouseEvent e) {          dispose();  }  void jButtonOk_mouseClicked(MouseEvent e) {    String sql;             sql="insert into BookBorrow(Studentname,Bookname,Borrowdate,Returndate,Comment)values(  ";               sql=sql+"'"+jTextstudentname.getText() +"',";                 sql=sql+"'"+jTextbookname.getText() +"',";                   sql=sql+"'"+jTextborrowdate.getText()+"',";//date                    sql=sql+"'',";                       sql=sql+"'"+jTextcomment.getText() +"'";             sql=sql+")";            if(db.executeSql(sql)){                  JOptionPane.showMessageDialog(null,"Add successed!");                }               else               {                 JOptionPane.showMessageDialog(null,"Add failed!");               }  }}class borrow_jButtonReset_mouseAdapter extends java.awt.event.MouseAdapter {  borrow adaptee;  borrow_jButtonReset_mouseAdapter(borrow adaptee) {    this.adaptee = adaptee;  }  public void mouseClicked(MouseEvent e) {    adaptee.jButtonReset_mouseClicked(e);  }}class borrow_jButtonCancel_mouseAdapter extends java.awt.event.MouseAdapter {  borrow adaptee;  borrow_jButtonCancel_mouseAdapter(borrow adaptee) {    this.adaptee = adaptee;  }  public void mouseClicked(MouseEvent e) {    adaptee.jButtonCancel_mouseClicked(e);  }}class borrow_jButtonOk_mouseAdapter extends java.awt.event.MouseAdapter {  borrow adaptee;  borrow_jButtonOk_mouseAdapter(borrow adaptee) {    this.adaptee = adaptee;  }  public void mouseClicked(MouseEvent e) {    adaptee.jButtonOk_mouseClicked(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -