com.nitdlibrary.ReportGenerator.java Source code

Java tutorial

Introduction

Here is the source code for com.nitdlibrary.ReportGenerator.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nitdlibrary;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.sql.*;
import java.text.DateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import managers.Config;
import org.joda.time.LocalDate;

/**
 *
 * @author MAYANK
 */
public class ReportGenerator extends javax.swing.JFrame {
    int issueID, acc, roll;
    Connection library;
    ResultSet books, issue, student, issueIDTable;

    /**
     * Creates new form ReportGenerator
     */
    public ReportGenerator(int issueKey) {
        try {
            initComponents();
            updateView(issueKey); // library gets initialized
            Statement issueIDQuery = library.createStatement();
            issueIDTable = issueIDQuery.executeQuery("select issue_id from issue");
            while (issueIDTable.next()) // moving cursor to current location in issueIDTable result set. use for navigation. bug #26
            {
                if (issueKey == (int) issueIDTable.getInt("issue_id"))
                    break;
            }
        } catch (Exception ex) {
            Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /**
     * Creates new form ReportGenerator after taking accNo and rollNO
     * @param accNo
     * @param rollNo
     */
    public ReportGenerator(int accNo, int rollNo) {
        try {
            initComponents();
            System.out.println("accNO :" + accNo + " rollNo : " + rollNo);
            this.library = NITDLibrary.createConnection();
            PreparedStatement query = library
                    .prepareStatement("select issue_id from issue where issuer_id = ? and acc_no = ?");
            query.setInt(1, new Integer(rollNo));
            query.setInt(2, new Integer(accNo));
            ResultSet issueIdResultSet = query.executeQuery();
            issueIdResultSet.next();
            int issueKey = issueIdResultSet.getInt("issue_id");
            updateView(issueKey);
            Statement issueIDQuery = library.createStatement();
            issueIDTable = issueIDQuery.executeQuery("select issue_id from issue");
            while (issueIDTable.next()) // moving cursor to current location in issueIDTable result set. use for navigation. bug # 26.
            {
                if (issueKey == (int) issueIDTable.getInt("issue_id"))
                    break;
            }
        } catch (Exception ex) {
            Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /**
     * This method extracts details from database into result sets and updates fields
     */
    private void updateView(int issueKey) throws Exception {
        DateFormat format = Config.dateFormat;

        todayLabel.setText("Today's Date : " + (new LocalDate(new java.util.Date())).toString("yyyy-MM-dd"));
        this.issueID = issueKey;
        this.library = NITDLibrary.createConnection();
        PreparedStatement queryIssue = library.prepareStatement("select * from issue where issue_id = ?");
        queryIssue.setInt(1, issueID);
        issue = queryIssue.executeQuery();
        issue.next();
        /**
         * Updating issue related fields
         */
        issueIDLabel.setText((new Integer(issueID).toString()));
        LocalDate issueDateJoda = new LocalDate(issue.getString("issue_date"));
        LocalDate returnDateJoda = null;
        if (issue.getString("return_date") != null) {
            returnDateJoda = new LocalDate(issue.getString("return_date"));
            returnDate.setText(returnDateJoda.toString("dd-MM-yyyy"));
        } else
            returnDate.setText(null);
        //         System.out.println("RETURN DATE : " + returnDateJoda.toString());
        LocalDate dueDateJoda = new LocalDate(issue.getString("due_date"));
        issueDate.setText(issueDateJoda.toString("dd-MM-yyyy"));

        dueDate.setText(dueDateJoda.toString("dd-MM-yyyy"));
        int exceed = Config.daysExceeded(issue.getString("return_date"), issue.getString("due_date"));
        if (exceed < 0)
            exceed = 0;
        exceedSpinner.setValue(exceed);
        fine.setText((new Integer(exceed * Config.ChARGEPERDAY).toString()));
        acc = issue.getInt("acc_no");
        roll = issue.getInt("issuer_id");
        /**
         * Obtaining result sets for books and student
         */
        ResultSet[] holder = Config.getReportData(acc, roll);
        books = holder[0];
        student = holder[1];
        books.next();
        student.next();
        /**
         * updating student fields
         */
        fname.setText(student.getString("First Name"));
        lname.setText(student.getString("Last Name"));
        contactnumber.setText(student.getString("Contact Number"));
        email.setText(student.getString("E-Mail"));
        rollno.setText(student.getString("roll_no"));
        cardno.setText(student.getString("Card Numbers"));
        category.setText(student.getString("Category"));
        programme.setText(student.getString("Programme"));
        branch.setText(student.getString("Branch"));
        /**
         * CHECKING IF STUDENT IS PASSED OUT
         */
        String programmeString = student.getString("Programme");
        if (Config.isPassed(programmeString, student.getInt("Year"))) {
            yearStudent.setText("Passed Out");
        } else {
            yearStudent.setText(student.getString("Year")); // so that when changes are saved data is not lost
        }
        Image image = null;
        try {
            image = ImageIO.read(new File(student.getString("pic_path")));
        } catch (IOException ex) {
            Logger.getLogger(EditViewStudent.class.getName()).log(Level.SEVERE, null, ex);
        }
        Image scaledImage = getScaledImage(image, 168, 130);
        picLabel.setIcon(new ImageIcon(scaledImage));

        /**
         * Load details for book
         */
        title.setText(books.getString("title"));
        author1.setText(books.getString("author"));
        author2.setText(books.getString("author2"));
        author3.setText(books.getString("author3"));
        isbn.setText(books.getString("ISBN"));
        publisher.setText(books.getString("publisher"));
        edition.setText(books.getString("edition"));
        price.setText((new Float(books.getFloat("price")).toString()));
        String[] yearFull = books.getString("year").split("[-]");
        year.setText(yearFull[0]);
        pagination.setText((new Integer(books.getInt("pagination")).toString()));

        subjectCombo.setText(books.getString("subject"));

        location.setText(books.getString("location"));
        accNo.setText(books.getString("acc_no"));
        switch (books.getInt("status")) {
        case 0:
            status.setText("None");
            break;
        case 1:
            status.setText("Students");
            break;
        case 2:
            status.setText("Teachers");
            break;
        case 3:
            status.setText("All");
            break;
        }

    }

    /**
     * GET SCALED IMAGE
     */
    private Image getScaledImage(Image srcImg, int w, int h) {
        BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = resizedImg.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2.drawImage(srcImg, 0, 0, w, h, null);
        g2.dispose();
        return resizedImg;
    }

    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gotoDialog = new javax.swing.JDialog();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel32 = new javax.swing.JLabel();
        issueIdDialog = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        rollNoDialog = new javax.swing.JTextField();
        accNoDialog = new javax.swing.JTextField();
        gotoButtonDialog = new javax.swing.JButton();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        title = new javax.swing.JTextField();
        author1 = new javax.swing.JTextField();
        author2 = new javax.swing.JTextField();
        author3 = new javax.swing.JTextField();
        subjectCombo = new javax.swing.JTextField();
        isbn = new javax.swing.JTextField();
        publisher = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        accNo = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        price = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        edition = new javax.swing.JTextField();
        year = new javax.swing.JTextField();
        pagination = new javax.swing.JTextField();
        location = new javax.swing.JTextField();
        status = new javax.swing.JTextField();
        jToolBar1 = new javax.swing.JToolBar();
        navPrev = new javax.swing.JButton();
        navNext = new javax.swing.JButton();
        navGoto = new javax.swing.JButton();
        print = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        fname = new javax.swing.JTextField();
        lname = new javax.swing.JTextField();
        category = new javax.swing.JTextField();
        programme = new javax.swing.JTextField();
        branch = new javax.swing.JTextField();
        yearStudent = new javax.swing.JTextField();
        cardno = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        picLabel = new javax.swing.JLabel();
        rollno = new javax.swing.JTextField();
        email = new javax.swing.JTextField();
        contactnumber = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        issueIDLabel = new javax.swing.JTextField();
        issueDate = new javax.swing.JTextField();
        returnDate = new javax.swing.JTextField();
        dueDate = new javax.swing.JTextField();
        exceedSpinner = new javax.swing.JSpinner();
        fine = new javax.swing.JTextField();
        todayLabel = new javax.swing.JLabel();

        gotoDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        gotoDialog.setMinimumSize(new java.awt.Dimension(320, 320));
        gotoDialog.setName("GoTo Details\n"); // NOI18N

        jSeparator1.setMinimumSize(new java.awt.Dimension(325, 350));

        jLabel32.setText("Enter Issue ID");

        jLabel33.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel33.setText("OR");

        jLabel34.setText("Enter Roll_No :");

        jLabel35.setText("Enter Acc. No :");

        gotoButtonDialog.setText("GoTo");
        gotoButtonDialog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gotoButtonDialogActionPerformed(evt);
            }
        });

        jLabel36.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        jLabel36.setText("Enter Details to GoTo Record");

        jLabel37.setText("* ensure Issue ID is empty when using second option");

        javax.swing.GroupLayout gotoDialogLayout = new javax.swing.GroupLayout(gotoDialog.getContentPane());
        gotoDialog.getContentPane().setLayout(gotoDialogLayout);
        gotoDialogLayout.setHorizontalGroup(gotoDialogLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jSeparator2)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gotoDialogLayout.createSequentialGroup()
                        .addGap(0, 45, Short.MAX_VALUE)
                        .addGroup(gotoDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gotoDialogLayout
                                        .createSequentialGroup().addComponent(jLabel32).addGap(18, 18, 18)
                                        .addComponent(issueIdDialog, javax.swing.GroupLayout.PREFERRED_SIZE, 66,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(80, 80, 80))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        gotoDialogLayout.createSequentialGroup().addComponent(jLabel37).addGap(25,
                                                25, 25))))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gotoDialogLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(gotoDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        gotoDialogLayout.createSequentialGroup()
                                                .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(109, 109, 109))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        gotoDialogLayout.createSequentialGroup().addComponent(gotoButtonDialog)
                                                .addGap(125, 125, 125))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        gotoDialogLayout.createSequentialGroup().addComponent(jLabel36).addGap(80,
                                                80, 80))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        gotoDialogLayout.createSequentialGroup()
                                                .addGroup(gotoDialogLayout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                                        .addGroup(gotoDialogLayout.createSequentialGroup()
                                                                .addComponent(jLabel35).addGap(18, 18, 18)
                                                                .addComponent(accNoDialog))
                                                        .addGroup(gotoDialogLayout.createSequentialGroup()
                                                                .addComponent(jLabel34).addGap(18, 18, 18)
                                                                .addComponent(rollNoDialog,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 81,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGap(76, 76, 76)))));
        gotoDialogLayout.setVerticalGroup(gotoDialogLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(gotoDialogLayout.createSequentialGroup().addContainerGap()
                        .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 16,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(gotoDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel32).addComponent(issueIdDialog,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 4,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(gotoDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel34).addComponent(rollNoDialog,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(gotoDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel35).addComponent(accNoDialog,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel37)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(gotoButtonDialog).addContainerGap()));

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory
                .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Book Details"));

        jLabel1.setText("Title :");

        jLabel2.setText("Author 1 :");

        jLabel3.setText("Author 2 :");

        jLabel4.setText("Author 3:");

        jLabel5.setText("Subject :");

        jLabel6.setText("ISBN :");

        jLabel7.setText("Publisher :");

        jLabel8.setText("Acc No :");

        jLabel9.setText("Price :");

        jLabel10.setText("Edition :");

        jLabel11.setText("Year :");

        jLabel12.setText("Pagination :");

        jLabel13.setText("Location :");

        jLabel14.setText("Available To :");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 59,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2).addComponent(jLabel3).addComponent(jLabel4).addComponent(jLabel5)
                        .addComponent(jLabel6).addComponent(jLabel7)).addGap(18, 18, 18)
                        .addGroup(jPanel1Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(title).addComponent(author1).addComponent(author2)
                                .addComponent(author3).addComponent(subjectCombo).addComponent(isbn).addComponent(
                                        publisher, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE))
                        .addGap(41, 41, 41)
                        .addGroup(jPanel1Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel12)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(pagination))
                                .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel13)
                                        .addGap(18, 18, 18).addComponent(location))
                                .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel14)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(status, javax.swing.GroupLayout.DEFAULT_SIZE, 86,
                                                Short.MAX_VALUE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel9).addComponent(jLabel8).addComponent(jLabel10)
                                                .addComponent(jLabel11))
                                        .addGap(26, 26, 26)
                                        .addGroup(jPanel1Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(price).addComponent(accNo).addComponent(edition)
                                                .addComponent(year, javax.swing.GroupLayout.DEFAULT_SIZE, 89,
                                                        Short.MAX_VALUE))))
                        .addContainerGap(18, Short.MAX_VALUE)));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1)
                        .addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8).addComponent(accNo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel2)
                                .addComponent(author1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel9).addComponent(price, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3)
                                .addComponent(author2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel10).addComponent(edition,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel4)
                                .addComponent(author3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel11).addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(12, 12, 12)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(subjectCombo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel12).addComponent(pagination,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel6)
                                .addComponent(isbn, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel13).addComponent(location,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel7)
                                .addComponent(publisher, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel14).addComponent(status, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jToolBar1.setRollover(true);

        navPrev.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/navigation_previous.png"))); // NOI18N
        navPrev.setFocusable(false);
        navPrev.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        navPrev.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        navPrev.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                navPrevActionPerformed(evt);
            }
        });
        jToolBar1.add(navPrev);

        navNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/navigation_next.png"))); // NOI18N
        navNext.setFocusable(false);
        navNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        navNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        navNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                navNextActionPerformed(evt);
            }
        });
        jToolBar1.add(navNext);

        navGoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/navigation_goto.png"))); // NOI18N
        navGoto.setFocusable(false);
        navGoto.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        navGoto.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        navGoto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                navGotoActionPerformed(evt);
            }
        });
        jToolBar1.add(navGoto);

        print.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/print.png"))); // NOI18N
        print.setFocusable(false);
        print.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        print.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        print.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                printActionPerformed(evt);
            }
        });
        jToolBar1.add(print);

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel15.setText("REPORT VIEWER");

        jPanel2.setBorder(javax.swing.BorderFactory
                .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Student Details"));
        jPanel2.setName(""); // NOI18N

        jLabel16.setText("First Name :");

        jLabel17.setText("Last Name :");

        jLabel18.setText("Category :");

        jLabel19.setText("Programme :");

        jLabel20.setText("Branch :");

        jLabel21.setText("Year :");

        jLabel22.setText("Card Numbers :");

        jLabel23.setText("Roll No :");

        jLabel24.setText("E-Mail ID :");

        jLabel25.setText("Contact No:");

        picLabel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addGap(20, 20, 20).addGroup(jPanel2Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel16).addComponent(jLabel17).addComponent(jLabel18)
                                        .addComponent(jLabel19).addComponent(jLabel20).addComponent(jLabel21))
                                .addGap(32, 32, 32)
                                .addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(fname).addComponent(lname)
                                        .addComponent(category, javax.swing.GroupLayout.DEFAULT_SIZE, 126,
                                                Short.MAX_VALUE)
                                        .addComponent(branch, javax.swing.GroupLayout.DEFAULT_SIZE, 126,
                                                Short.MAX_VALUE)
                                        .addComponent(programme).addComponent(yearStudent,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 75,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel2Layout.createSequentialGroup().addComponent(jLabel22).addGap(18, 18, 18)
                                .addComponent(cardno, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(54, 54, 54)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(jLabel23).addComponent(jLabel24)
                                                .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.LEADING))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(rollno,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 86,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(0, 62, Short.MAX_VALUE))
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addGroup(jPanel2Layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addComponent(email).addComponent(contactnumber))
                                                        .addContainerGap())))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel2Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(picLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 133,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(47, 47, 47)))));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel16)
                        .addComponent(fname, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel23).addComponent(rollno, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel17)
                                .addComponent(lname, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel24).addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel18)
                                .addComponent(category, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel25).addComponent(contactnumber,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel19)
                                                .addComponent(programme, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(jPanel2Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel20).addComponent(branch,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(jPanel2Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(jLabel21).addComponent(yearStudent,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        7, Short.MAX_VALUE)
                                                .addGroup(jPanel2Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(cardno,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel22))
                                                .addContainerGap())
                                        .addComponent(picLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));

        jPanel3.setBorder(javax.swing.BorderFactory
                .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Issue Details"));

        jLabel26.setText("Issue Date :");

        jLabel27.setText("Return Date :");

        jLabel28.setText("Due Date :");

        jLabel29.setText("No of Days Exceeded :");

        jLabel30.setText("Fine :");

        jLabel31.setText("Issue ID :");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel3Layout
                        .createSequentialGroup().addGap(29, 29, 29).addGroup(jPanel3Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addGroup(jPanel3Layout.createSequentialGroup().addComponent(jLabel30)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(
                                                        fine, javax.swing.GroupLayout.PREFERRED_SIZE, 57,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(29, 29, 29))
                                        .addGroup(jPanel3Layout.createSequentialGroup()
                                                .addGroup(jPanel3Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel27).addComponent(jLabel28))
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(jPanel3Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(returnDate).addComponent(dueDate)))
                                        .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel26).addComponent(jLabel31)).addGap(18, 18, 18)
                                                .addGroup(jPanel3Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(issueIDLabel,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 80,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(issueDate,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 85,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(jLabel29)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(exceedSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 51,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(20, Short.MAX_VALUE)));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel31).addComponent(issueIDLabel,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel26).addComponent(issueDate,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel27).addComponent(returnDate,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel28).addComponent(dueDate,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel29).addComponent(exceedSpinner,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel30).addComponent(fine, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap()));

        todayLabel.setText("Date :");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGap(33, 33, 33)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 20, Short.MAX_VALUE))
                .addGroup(layout.createSequentialGroup().addGap(43, 43, 43).addComponent(todayLabel)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup().addGap(215, 215, 215).addComponent(
                                        jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup().addGap(187, 187, 187).addComponent(
                                        jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 188,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(131, 131, 131)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup().addGap(44, 44, 44).addComponent(todayLabel)))
                        .addContainerGap(103, Short.MAX_VALUE)));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void navNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_navNextActionPerformed
        try {
            issueIDTable.next();
            issueID = issueIDTable.getInt("issue_id");
            updateView(issueID);
        } catch (Exception ex) {
            try {
                issueIDTable.previous();
                issueID = issueIDTable.getInt("issue_id");
            } catch (SQLException ex1) {
                Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex1);
            }

            try {
                updateView(issueID);
            } catch (Exception ex1) {
                Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex1);
            }
            Error.errorDialog("No records to display");
            Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_navNextActionPerformed

    private void navPrevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_navPrevActionPerformed
        try {
            issueIDTable.previous();
            issueID = issueIDTable.getInt("issue_id");
            updateView(issueID);
        } catch (Exception ex) {
            try {
                issueIDTable.next();
                issueID = issueIDTable.getInt("issue_id");
                updateView(issueID);
                try {
                    updateView(issueID);
                } catch (Exception ex1) {
                    Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex1);
                }
                Error.errorDialog("No records to display");
                Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex1) {
                Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex1);
            } catch (Exception ex1) {
                Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex1);
            }
        }
    }//GEN-LAST:event_navPrevActionPerformed

    private void navGotoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_navGotoActionPerformed
        gotoDialog.setVisible(true);
    }//GEN-LAST:event_navGotoActionPerformed

    private void gotoButtonDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gotoButtonDialogActionPerformed
        try {
            System.out.println(issueIdDialog.getText());
            if (issueIdDialog.getText().length() != 0) {
                issueID = new Integer(issueIdDialog.getText());
                updateView(issueID);
            } else {
                PreparedStatement query = library
                        .prepareStatement("select issue_id from issue where issuer_id = ? and acc_no = ?");
                query.setInt(1, new Integer(rollNoDialog.getText()));
                query.setInt(2, new Integer(accNoDialog.getText()));
                ResultSet issueIdResultSet = query.executeQuery();
                issueIdResultSet.next();
                updateView(issueIdResultSet.getInt("issue_id"));
            }
        } catch (SQLException ex) {
            Error.errorDialog("No records found");
            Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_gotoButtonDialogActionPerformed

    private void printActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printActionPerformed
        managers.PrintUtilities.printComponent(this);
    }//GEN-LAST:event_printActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ReportGenerator.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ReportGenerator.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ReportGenerator.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ReportGenerator.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ReportGenerator(1).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField accNo;
    private javax.swing.JTextField accNoDialog;
    private javax.swing.JTextField author1;
    private javax.swing.JTextField author2;
    private javax.swing.JTextField author3;
    private javax.swing.JTextField branch;
    private javax.swing.JTextField cardno;
    private javax.swing.JTextField category;
    private javax.swing.JTextField contactnumber;
    private javax.swing.JTextField dueDate;
    private javax.swing.JTextField edition;
    private javax.swing.JTextField email;
    private javax.swing.JSpinner exceedSpinner;
    private javax.swing.JTextField fine;
    private javax.swing.JTextField fname;
    private javax.swing.JButton gotoButtonDialog;
    private javax.swing.JDialog gotoDialog;
    private javax.swing.JTextField isbn;
    private javax.swing.JTextField issueDate;
    private javax.swing.JTextField issueIDLabel;
    private javax.swing.JTextField issueIdDialog;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTextField lname;
    private javax.swing.JTextField location;
    private javax.swing.JButton navGoto;
    private javax.swing.JButton navNext;
    private javax.swing.JButton navPrev;
    private javax.swing.JTextField pagination;
    private javax.swing.JLabel picLabel;
    private javax.swing.JTextField price;
    private javax.swing.JButton print;
    private javax.swing.JTextField programme;
    private javax.swing.JTextField publisher;
    private javax.swing.JTextField returnDate;
    private javax.swing.JTextField rollNoDialog;
    private javax.swing.JTextField rollno;
    private javax.swing.JTextField status;
    private javax.swing.JTextField subjectCombo;
    private javax.swing.JTextField title;
    private javax.swing.JLabel todayLabel;
    private javax.swing.JTextField year;
    private javax.swing.JTextField yearStudent;
    // End of variables declaration//GEN-END:variables
}