title: Throw error if JTextField is empty
body: <p>I am trying to write a try catch block that will throw an exception if the user does not enter a name and just presses <code>enter</code> or <code>okay</code> I seem to be having issues because it doesn't throw anything it just accepts the blank and continues. Can someone help me? Thanks in advance!</p>
  
  <p>here is the function:</p>
  
  <pre><code>public String setOwnerName() {
          boolean isName = false;
  
          while(!isName) {
              try {
                  this.ownerName = JOptionPane.showInputDialog(null, "Enter the account owner's name.", "Owner's Name", JOptionPane.PLAIN_MESSAGE);
                  if(this.ownerName != "") {
                      isName = true;  
                  }
              } catch(IllegalArgumentException e) {
                  JOptionPane.showMessageDialog(null, "Error you did not enter a name, please try again.", "Error", JOptionPane.ERROR_MESSAGE);
              }
          }
          return this.ownerName;
      }
  </code></pre>