private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        jScrollPane1.setVisible(true);
        jScrollPane2.setVisible(false);
        DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
        int bookcode = 0;
        int n = 0;
        String bookname = null;
        String query;
        String query1 = null;
        int row = jTable1.getSelectedRow();
        int issuerid = 0;
        int m = 0;
        String username = t2.getText();

        if (row == -1)
        {
            JOptionPane.showMessageDialog(this, "Please Select a Book");
        } 
        else
        {
            bookcode = (Integer) model.getValueAt(row, 0);
            bookname = (String) model.getValueAt(row, 1);
        }
        try 
        {
            issuerid = Integer.parseInt(t1.getText());
        } 
        catch (NumberFormatException e) 
        {
            m = 1;
        }

        if (!(m == 1))
        {
            query1 = "select issuerid , username from users where issuerid=" + issuerid + ";";
        }
        else if (!(username.isEmpty())) 
        {
            query1 = "select issuerid , username from users where username='" + username + "';";

        }
        else if (!(n == 1 && username.isEmpty())) 
        {
            JOptionPane.showMessageDialog(this, "Please Enter any one of the user identifiers");
        } 
        else 
        {
            JOptionPane.showMessageDialog(this, "Please Enter the User details");
        }
        if (row != -1 && query1 != null) 
        {
            try {

                ResultSet rs = MyQueries.excQuery(query1);
                rs.next();
                issuerid = rs.getInt("issuerid");
                username = rs.getString("username");
                myClasses.Connections.close(); // Close connection to prevent Database lock
                query = "delete from accounts where bookcode=" + bookcode + " and bookname='" + bookname + "'and issuerid=" + issuerid + " and username='" + username + "';";
                MyQueries.excUpdate(query);
                myClasses.Connections.close(); // Close connection to prevent Database lock
                jButton1.doClick();
                JOptionPane.showMessageDialog(this, "Book Succesfully Returned");
            }
            catch (SQLException | HeadlessException f) 
            {
                JOptionPane.showMessageDialog(this, f.getMessage());
            }
        }
    }//GEN-LAST:event_jButton2ActionPerformed