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