title: Java GUI Jframe Exception handling
body: <p>I have a GUI design that has a number of fields that the user enters. I'm using a <code>try-catch</code> to deal with the exceptions that the user incorrectly enters. I was successful when the user enters a String into a number field (My <code>id</code> field) but I'm frustrated here trying to use an exception to handle when a user enters an integer into a text/String field. 
  Here is my code to give you an idea of what I did for the exception i did successfully. Thank you.</p>
  
  <pre><code>try {
  
      String taskID = txtId.getText();
      int id = Integer.parseInt(taskID);
  
      String taskName = txtName.getText();
  
      String taskDesc = txtDesc.getText();
  
      boolean isCompleted = chkComp.isSelected();
  
      int taskPriority = comboPriority.getSelectedIndex();
  
      Task newTask = new Task(id, taskName, taskDesc, isCompleted, taskPriority);
  
      tasks.add(newTask);
      taskMod.addElement(newTask);
  
  } catch (NumberFormatException e) {
      JOptionPane.showMessageDialog(null, "Error: You must enter an integer");
  
  }
  </code></pre>