public void addBorrower() { String borrowerEntry = borrowerField.getText(); try { int borrowerEntryInted = Integer.valueOf(borrowerEntry).intValue(); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(errorPane, "Please enter a whole number into the borrower field"); return; } if (lastBookCount == 0) { JOptionPane.showMessageDialog(errorPane, "The last search generated no books"); } else if (lastBookCount > 1) { JOptionPane.showMessageDialog(errorPane, "The last search generated more than one book"); } else if (borrowerEntry.length() == 0) { JOptionPane.showMessageDialog(errorPane, "The borrower text field is empty, please add a borrower id"); } }