// Name Validation method private void validateName(TextField input, TextField input1) { PlayerOld playerOld = new PlayerOld(); errorPopUp error = new errorPopUp(); String inputAge = input1.getText(); String inputName = input.getText(); if (inputName.length() == 0) { error.errorPop2("Title", "Message"); } else /*playerOld.*/ validateAge(inputAge, inputName); }
// Age validation method private boolean validateAge(String inputAge, String inputName) { errorPopUp error = new errorPopUp(); try { int age = Integer.parseInt(inputAge); System.out.println("Name is " + inputName + ", Age is " + age); selectLevel(levelCounter); return true; } catch (NumberFormatException e) { error.errorPop("Title", "Message"); return false; } }