public void removeRow() {
   try {
     if (tblUnitList.getSelectedRow() < 0) {
       Message.showWarning("Please select in the table");
       return;
     }
     //            if (((Number) model.getValueAt(0, 2)).intValue() > 0) {
     //                deleteUnitList.add((Integer) model.getValueAt(tblUnitList.getSelectedRow(),
     // 4));
     //            }
     if (userTask >= GlobalMode.EDIT
         && (int) model.getValueAt(tblUnitList.getSelectedRow(), 4) > 0) {
       if (JOptionPane.showConfirmDialog(
               this,
               "This unit is already in use. This will be permanently delete to the database. Do you still want to continue?",
               "WARNING",
               JOptionPane.YES_NO_OPTION)
           == JOptionPane.YES_OPTION) {
         totalLeaseArea -=
             ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 1)).doubleValue();
         rDB.deleteRentalDetailID(
             ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 4)).intValue(),
             totalLeaseArea);
         model.removeRow(tblUnitList.getSelectedRow());
       }
     } else {
       totalLeaseArea -=
           ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 1)).doubleValue();
       model.removeRow(tblUnitList.getSelectedRow());
     }
   } catch (Exception e) {
     Message.showError(e.getMessage());
   }
 }
  public void addUnitToTable(Object[] obj) {
    //        if (model == null) {
    //            model = (DefaultTableModel) tblUnitList.getModel();
    //        }

    for (int i = 0; i < model.getRowCount(); i++) {
      if (((Number) model.getValueAt(i, 2)).intValue() == (int) obj[2]) {
        Message.showWarning("UNIT Already Exist");
        return;
      }
    }
    model.addRow(obj);
    totalLeaseArea += ((Number) obj[1]).doubleValue();
    tblUnitList.requestFocus();
    tblUnitList.setRowSelectionInterval(0, 0);
    btnChooseUnit.requestFocus();
  }
  // METHODS for SEARCHING / RELOADING THE SEARCH VALUE
  public void loadTable() {
    try {
      model.getDataVector().removeAllElements();
      model.fireTableDataChanged();

      b.searchBuildingList(txtSearch.getText().trim().replaceAll("'", ""), buildingList);
      if (buildingList.isEmpty()) {
        Message.showWarning("Record not Found");
        txtSearch.requestFocus();
        return;
      }
      for (Object[] obj : buildingList) {
        model.addRow(obj);
      }
      if (model.getRowCount() > 0) {
        tblBuildingList.requestFocus();
        tblBuildingList.setRowSelectionInterval(0, 0);
      }
    } catch (Exception e) {
      Message.showError(e.getMessage());
    }
  }