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

📄 dlgreturnbook.java

📁 用java实现的一个应用程序,源码非常完整,可以直接运行
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package 毕业设计;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.util.*;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.table.DefaultTableModel;

public class dlgReturnBook extends JDialog {
    JPanel panel1 = new JPanel();
    JLabel lblReaId = new JLabel();
    JTextField txtReaId = new JTextField();
    JLabel lblReaName = new JLabel();
    JTextField txtReaName = new JTextField();
    JLabel lblRevertibleTime = new JLabel();
    JTextField txtRevertibleTime = new JTextField();
    JTextField txtLoanTime = new JTextField();
    JRadioButton rbnLibId = new JRadioButton();
    JTextField txtLibId = new JTextField();
    JRadioButton rbnBarCode = new JRadioButton();
    JTextField txtBarCode = new JTextField();
    JLabel lblLibName = new JLabel();
    JTextField txtLibName = new JTextField();
    JLabel lblAuthor = new JLabel();
    JTextField txtAuthor = new JTextField();
    JLabel lblPublish = new JLabel();
    JTextField txtPublish = new JTextField();
    JLabel lblPage = new JLabel();
    JTextField txtPage = new JTextField();
    JLabel lblPrice = new JLabel();
    JTextField txtPrice = new JTextField();
    JButton btnReaOK = new JButton();
    JTable tblDisplay = new JTable();
    JLabel lblReaLine = new JLabel();
    JLabel lblLibLine = new JLabel();
    JLabel lblNowTime = new JLabel();
    JTextField txtNowTime = new JTextField();
    JButton btnReturn = new JButton();
    JButton btnCancel = new JButton();
    JButton btnExit = new JButton();
    JLabel lblDisplay = new JLabel();
    ButtonGroup buttonGroup1 = new ButtonGroup();
    JLabel lblLoanCount = new JLabel();
    JTextField txtBorrowCount = new JTextField();
    JLabel lblLoanTime = new JLabel();
    JScrollPane jScrollPane1 = new JScrollPane();
    boolean Isnot = true;
    DefaultTableModel dt;
    Vector vtColName = new Vector();
    String[] column = {"编号", "读者编号", "图书编号", "图书条形码", "借书日期", "还书日期", "应还日期",
                      "操作人员"};
    JButton btnLibOK = new JButton();
    public dlgReturnBook() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        panel1.setLayout(null);
        setSize(new Dimension(700, 530));
        this.setTitle("图书归还");
        lblReaId.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblReaId.setForeground(Color.magenta);
        lblReaId.setText("读者编号:");
        lblReaId.setBounds(new Rectangle(421, 12, 89, 22));
        txtReaId.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtReaId.setBackground(new java.awt.Color(255, 236, 125));
        txtReaId.setText("");
        txtReaId.setBounds(new Rectangle(423, 37, 119, 30));
        lblReaName.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblReaName.setText("读者姓名:");
        lblReaName.setBounds(new Rectangle(349, 88, 74, 26));
        txtReaName.setBackground(Color.white);
        txtReaName.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtReaName.setEditable(false);
        txtReaName.setText("");
        txtReaName.setBounds(new Rectangle(423, 89, 222, 25));
        lblRevertibleTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblRevertibleTime.setForeground(Color.magenta);
        lblRevertibleTime.setText("应还日期:");
        lblRevertibleTime.setBounds(new Rectangle(345, 248, 78, 26));
        txtRevertibleTime.setBackground(Color.lightGray);
        txtRevertibleTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtRevertibleTime.setEditable(false);
        txtRevertibleTime.setText("");
        txtRevertibleTime.setBounds(new Rectangle(422, 243, 223, 31));
        txtLoanTime.setBackground(Color.white);
        txtLoanTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtLoanTime.setEditable(false);
        txtLoanTime.setText("");
        txtLoanTime.setBounds(new Rectangle(423, 164, 222, 29));
        rbnLibId.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        rbnLibId.setForeground(Color.magenta);
        rbnLibId.setText("图书编号:");
        rbnLibId.setBounds(new Rectangle(38, 16, 107, 19));
        rbnLibId.addChangeListener(new dlgReturnBook_rbnLibId_changeAdapter(this));
        txtLibId.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtLibId.setText("");
        txtLibId.setBounds(new Rectangle(37, 39, 100, 30));
        rbnBarCode.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        rbnBarCode.setForeground(Color.black);
        rbnBarCode.setToolTipText("");
        rbnBarCode.setText("图书条形码:");
        rbnBarCode.setBounds(new Rectangle(142, 13, 127, 23));
        txtBarCode.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtBarCode.setEditable(false);
        txtBarCode.setText("");
        txtBarCode.setBounds(new Rectangle(152, 39, 110, 30));
        lblLibName.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblLibName.setText("图书名称:");
        lblLibName.setBounds(new Rectangle(35, 88, 74, 30));
        txtLibName.setBackground(Color.white);
        txtLibName.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtLibName.setEditable(false);
        txtLibName.setText("");
        txtLibName.setBounds(new Rectangle(116, 87, 187, 31));
        lblAuthor.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblAuthor.setText("图书作者:");
        lblAuthor.setBounds(new Rectangle(34, 126, 70, 29));
        txtAuthor.setBackground(Color.white);
        txtAuthor.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtAuthor.setEditable(false);
        txtAuthor.setText("");
        txtAuthor.setBounds(new Rectangle(113, 127, 187, 30));
        lblPublish.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblPublish.setText("出 版 社:");
        lblPublish.setBounds(new Rectangle(32, 167, 71, 26));
        txtPublish.setBackground(Color.white);
        txtPublish.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtPublish.setEditable(false);
        txtPublish.setText("");
        txtPublish.setBounds(new Rectangle(111, 168, 188, 29));
        lblPage.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblPage.setText("图书页数:");
        lblPage.setBounds(new Rectangle(33, 206, 68, 28));
        txtPage.setBackground(Color.white);
        txtPage.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtPage.setEditable(false);
        txtPage.setText("");
        txtPage.setBounds(new Rectangle(110, 206, 191, 31));
        lblPrice.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblPrice.setText("图书价格:");
        lblPrice.setBounds(new Rectangle(31, 245, 66, 27));
        txtPrice.setBackground(Color.white);
        txtPrice.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtPrice.setEditable(false);
        txtPrice.setText("");
        txtPrice.setBounds(new Rectangle(109, 245, 194, 30));
        btnReaOK.setBounds(new Rectangle(592, 35, 74, 30));
        btnReaOK.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        btnReaOK.setText("确认");
        btnReaOK.addActionListener(new dlgReturnBook_btnOK_actionAdapter(this));
        tblDisplay.setFont(new java.awt.Font("Dialog", Font.PLAIN, 12));
        tblDisplay.setBounds(new Rectangle(19, 313, 657, 124));
        lblReaLine.setBorder(BorderFactory.createEtchedBorder());
        lblReaLine.setText("");
        lblReaLine.setBounds(new Rectangle(15, 8, 670, 67));
        lblLibLine.setBorder(BorderFactory.createEtchedBorder());
        lblLibLine.setText("");
        lblLibLine.setBounds(new Rectangle(13, 80, 673, 200));
        lblNowTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblNowTime.setForeground(Color.red);
        lblNowTime.setText("当前日期:");
        lblNowTime.setBounds(new Rectangle(346, 204, 72, 24));
        txtNowTime.setBackground(Color.lightGray);
        txtNowTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtNowTime.setEditable(false);
        txtNowTime.setText(getNowTime());
        txtNowTime.setBounds(new Rectangle(423, 203, 223, 27));
        btnReturn.setBounds(new Rectangle(360, 456, 75, 32));
        btnReturn.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        btnReturn.setForeground(Color.red);

        btnReturn.setText("还书");
        btnReturn.addActionListener(new dlgReturnBook_btnReturn_actionAdapter(this));
        btnCancel.setBounds(new Rectangle(483, 457, 72, 31));
        btnCancel.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        btnCancel.setText("清空");
        btnCancel.addActionListener(new dlgReturnBook_btnCancel_actionAdapter(this));
        btnExit.setBounds(new Rectangle(604, 456, 73, 30));
        btnExit.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        btnExit.setText("退出");
        btnExit.addActionListener(new dlgReturnBook_btnExit_actionAdapter(this));
        lblDisplay.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
        lblDisplay.setText("读者已借图书");
        lblDisplay.setBounds(new Rectangle(300, 287, 125, 16));
        lblLoanCount.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblLoanCount.setText("借书次数:");
        lblLoanCount.setBounds(new Rectangle(348, 128, 75, 27));
        txtBorrowCount.setBackground(Color.white);
        txtBorrowCount.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        txtBorrowCount.setEditable(false);
        txtBorrowCount.setText("");
        txtBorrowCount.setBounds(new Rectangle(423, 124, 222, 29));
        lblLoanTime.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        lblLoanTime.setText("借书日期:");
        lblLoanTime.setBounds(new Rectangle(345, 165, 74, 28));
        jScrollPane1.setBounds(new Rectangle(13, 307, 671, 135));
        btnLibOK.setBounds(new Rectangle(291, 37, 80, 30));
        btnLibOK.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
        btnLibOK.setText("确认");
        btnLibOK.addActionListener(new dlgReturnBook_btnLibOK_actionAdapter(this));
        getContentPane().add(panel1);
        panel1.add(txtLibName);
        panel1.add(txtLibId);
        panel1.add(rbnLibId);
        panel1.add(lblReaName);
        panel1.add(btnExit);
        panel1.add(lblLibName);
        panel1.add(txtPrice);
        panel1.add(txtAuthor);
        panel1.add(txtPage);
        panel1.add(txtPublish);
        panel1.add(lblPrice);
        panel1.add(lblPage);
        panel1.add(lblPublish);
        panel1.add(lblAuthor);
        panel1.add(txtLoanTime);
        panel1.add(txtReaName);
        panel1.add(lblDisplay);
        panel1.add(lblLoanTime);
        panel1.add(txtBorrowCount);
        panel1.add(lblLoanCount);
        panel1.add(btnReturn);
        panel1.add(btnCancel);
        panel1.add(jScrollPane1);
        panel1.add(txtRevertibleTime);
        panel1.add(lblRevertibleTime);
        panel1.add(txtNowTime);
        panel1.add(rbnBarCode);
        panel1.add(txtBarCode);
        panel1.add(btnReaOK);
        panel1.add(txtReaId);
        panel1.add(lblReaId);
        panel1.add(btnLibOK);
        panel1.add(lblReaLine);
        panel1.add(lblLibLine);
        panel1.add(lblNowTime);
        this.setResizable(false);
        jScrollPane1.getViewport().add(tblDisplay);
        buttonGroup1.add(rbnLibId);
        buttonGroup1.add(rbnBarCode);
        rbnLibId.setSelected(true);
        for (int i = 0; i < column.length; i++) {
            vtColName.add(column[i]);
        }
        Vector nullvt = new Vector();
        dt = new DefaultTableModel(nullvt, vtColName);
        tblDisplay.setModel(dt);
        tblDisplay.setAutoResizeMode(tblDisplay.AUTO_RESIZE_OFF);
        tblDisplay.getTableHeader().setReorderingAllowed(false);
    }

    //***************************显示当前时间***********************************
     public String getNowTime() {
         Calendar c = Calendar.getInstance();
         java.sql.Date dd = new java.sql.Date(c.getTimeInMillis());
         java.sql.Time tt = new java.sql.Time(c.getTimeInMillis());
         String NowTime;
         NowTime = dd.toString();
         return NowTime;
     }

     //**************************判断借出过期未还书记录****************************
       public boolean IsnotOverdueBook(String EndTime) {
           boolean Isnot = false;
           Vector vt = new Vector();
           Calendar c = Calendar.getInstance();
           java.sql.Date dd = new java.sql.Date(c.getTimeInMillis());
           String NowTime;
           int year, month, day;
           NowTime = dd.toString();

⌨️ 快捷键说明

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