private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
// TODO add your handling code here:
    if (v1.size() == 0) {

        JOptionPane.showMessageDialog(null, "You must enter Author Name to \n save book details");
    } else if ((jTextField2.getText().equals(""))) {
        JOptionPane.showMessageDialog(null, "You must Enter\n Book Name");
    } else if (jTextField2.getText().length() > 21) {
        JOptionPane.showMessageDialog(null, "Maximum Book Name Length is 25 characters");
    } else if (!(jTextField3.getText().equals(jTextField4.getText()))) {
        JOptionPane.showMessageDialog(null, "Total Quentity must be Equal to \n Available Quentity");
    } else {
        try {

            DB.myConnection().createStatement().executeUpdate("insert into book values ('" + jTextField1.getText() + "','" + jTextField2.getText() + "','" + jTextField3.getText() + "','" + jTextField4.getText() + "','" + librarianId + "','" + cmbRackID.getSelectedItem().toString() + "','" + LoadCategory.getCategoryID(cmbCategory.getSelectedItem().toString()) + "','" + jTextField6.getText() + "','" + LoadPublisher.selectPublisherID(cmbPublisher.getSelectedItem().toString()) + "')");
            save_AuthorBook.save_AuthorBook(v1, jTextField1.getText());
        } catch (Exception e) {
        }

        jTextField2.setText("");
        jTextField3.setText("");
        jTextField4.setText("");
        btnRemove.setEnabled(false);
        jLabel12.setText(Date1.myDate());
        jLabel10.setText(librianName);
        jTextField1.setText(GenerateBookID.getBookID());
        jButton1.setEnabled(true);
        cmbCategory.setModel(new DefaultComboBoxModel(LoadCategory.selectAllCategory()));
        cmbRackID.setModel(new DefaultComboBoxModel(LoadRackID.selectAllRackID()));
        cmbPublisher.setModel(new DefaultComboBoxModel(LoadPublisher.selectAllPublisher()));
        v2 = LoadAuthor.selectAllAuthor();
        jList1.setListData(v2);
        v1.removeAllElements();
        jList3.setListData(v1);
        jList1.setSelectedIndex(0);

        jTextField6.setText("Select Book Image");
        jTextField2.grabFocus();
    }
}//GEN-LAST:event_btnSaveActionPerformed