title: Java Text Box Validation Using Double.parseDouble()
body: <p>I have a Swing <code>JTextBox</code> that basically will hold a double.  </p>
  
  <p>I find that using:  </p>
  
  <pre><code>  Double.parseDouble(this.myTB.getText());
  </code></pre>
  
  <p>will throw an exception (and thus program is terminated) whenever <code>Double.parseDouble()</code> gets invalid input.</p>
  
  <p>My question: is there an easy way to NOT throw an exception, and instead return an integer <code>(-1)</code> saying that parseDouble() failed?</p>
  
  <p>I am trying to make a popup for the user saying he or she's data field is invalid.</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Thanks lol.  How could I forget about catching exceptions? it's been a long day!</p>