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

📄 bookm.java

📁 JAVA图书管理系统有很多代码这只是很小的一部分
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * BookM.java
 *
 * Created on 2007年11月14日, 上午10:25
 */

/**
 *
 * @author  Administrator
 */
package library;
import javax.swing.JOptionPane;
import java.util.*;
public class BookM extends javax.swing.JFrame {
     String code;
     String name;
     String type;
     String press;
     String writer;
     boolean isBorrow;
     String reader_code; 
    public static String cCode;
    int bokRecord;
    int bokPage;
    int bookRecord;
    int bookPage;
    Book book=new Book(code,name,type,press,writer,isBorrow,reader_code);
    DataBase database=new DataBase();
    ArrayList list=new ArrayList();
    /** Creates new form BookM */
    public BookM() {
        initComponents();
        list=database.getBooks();
        String code;
        String name;
        String type;
        String press;
        String writer;
        boolean isBorrow;
        String reader_code;
        for(int i=0;i<5;i++){
            book=(Book)list.get(i);
            code=book.getCode();
            name=book.getName();
            type=book.getType();
            press=book.getPress();
            writer=book.getWriter();
            isBorrow=book.getIsBorrow();
            System.out.println(isBorrow);
            reader_code=book.getReader_code();          
            bookTabel.setValueAt(code,i,0);            
            bookTabel.setValueAt(name,i,1);
            bookTabel.setValueAt(type,i,2);
            bookTabel.setValueAt(press,i,3);
            bookTabel.setValueAt(writer,i,4);
            if (isBorrow){
              bookTabel.setValueAt(true,i,5); 
            }else{
              bookTabel.setValueAt(false,i,5);  
            }           
            bookTabel.setValueAt(reader_code,i,6);     
        }
        bokPage=1;
        bokRecord=5;
        bookRecord=list.size();
        bookPage=(bookRecord+4)/5;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane2 = new javax.swing.JScrollPane();
        bookTabel = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        Return = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("\u56fe\u4e66\u7ba1\u7406");
        bookTabel.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "编号", "书名", "类型", "出版社", "作者", "是否借出", "读者编号"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane2.setViewportView(bookTabel);

        jButton1.setText("\u7b2c\u4e00\u9875");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("\u524d\u4e00\u9875");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("\u540e\u4e00\u9875");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("\u6700\u672b\u9875");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setText("\u7f16\u8f91");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        Return.setText("\u8fd4\u56de");
        Return.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ReturnActionPerformed(evt);
            }
        });

        jLabel1.setText("\u56fe\u4e66\u7ba1\u7406\uff1a");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(jButton1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jButton2)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jButton3)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jButton4)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jButton5)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(Return))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
                    .add(jLabel1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(21, Short.MAX_VALUE)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 121, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(19, 19, 19)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jButton3)
                    .add(jButton2)
                    .add(jButton1)
                    .add(jButton5)
                    .add(Return)
                    .add(jButton4))
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO 将在此处添加您的处理代码:
        this.hide();
        BookEdit be=new BookEdit();
        be.show();
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO 将在此处添加您的处理代码:
        Book book=new Book(code,name,type,press,writer,isBorrow,reader_code);
        bokPage=bookPage;
        bokRecord=(bookPage-1)*5+1;
        String code;
        String name;
        String type;
        String press;
        boolean isBorrow;
        String writer;
        String reader_code;
        int currentBookPoint=bokRecord-1;
           for(int i=0;i<5;i++){
            if(bokRecord<=bookRecord){
            book=(Book)list.get(currentBookPoint);
            code=book.getCode();

⌨️ 快捷键说明

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