Skip to content

Instantly share code, notes, and snippets.

@ahn94
Created July 12, 2015 01:06
Extract and validate textview input
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