I am trying to implement data validation for my program:
private boolean typeVal (TextField typeInput, String typeMessage){
try {
String type = (typeInput.getText());
addButtonClicked();
return true;
}catch(NumberFormatException e) {
AlertBox.display("Datatype Error", "Please check all fields are entered and are using correct datatypes");
return false;
}
}
This is one example of the validators that I am trying to create, the problem comes when someone enters a string of numbers. Is there anyway to make this more specific to just certain characters?