private static int getChoiceNumber(File[] foundBudgets) { String toCheck = Listener.getInput(); int highestChoice = foundBudgets.length; while (InputValidator.inputNotABudget(toCheck, highestChoice)) toCheck = Listener.getInput(); if (!(toCheck.equals("exit"))) return (Integer.valueOf(toCheck) - 1); else return -5; }
public static void getLoadDirectory() { AnsiConsole.out.println(ansi().eraseScreen()); Printer.print("savedInDefault"); System.out.println(BudgetBoss.getDefaultDirectory()); Printer.print("whereSaved"); String toCheck = Listener.getInput(); while (InputValidator.pathIsInvalid(toCheck)) toCheck = Listener.getInput(); if (!(toCheck.equals("exit"))) { if (toCheck.equalsIgnoreCase("y")) { searchDirectory(BudgetBoss.getDefaultDirectory()); } else searchDirectory(toCheck); } }
public void getOption(MasterMenu menu) { displayMenu(); System.out.println(errorMessage); String userInput = Listener.getInput(); while (InputValidator.menuChoiceIsInvalid(userInput, menu)) { displayMenu(); System.out.println(errorMessage); userInput = Listener.getInput(); } if (!(userInput.equalsIgnoreCase("exit"))) { int optionChose = Integer.valueOf(userInput); chooseOption(optionChose); } }