Created
July 12, 2015 01:06
-
-
Save ahn94/5cfd0596adbb8c8c7002 to your computer and use it in GitHub Desktop.
Extract and validate textview input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isInt(TextField input, String message){ | |
try { | |
int age = Integer.parseInt(input.getText()); | |
System.out.println("user is: " + age); | |
return true; | |
} catch (NumberFormatException e){ | |
System.out.println("Error: " + message + " is not a number"); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment