public static Integer primeInput(final JTextField inputField, final MainFrame mainFrame, final boolean odd) {
        try {
            final String input = inputField.getText();
            final Integer result = Integer.parseInt(input);
            if ((result == 2) && odd)
                throw new NumberFormatException("2 is not allowed.");
            if (!Algorithms.isPrime(result))
                throw new NumberFormatException("The input is not a prime.");
            inputField.setBackground(Color.white);
            return result;
        } catch (NumberFormatException ex) {
            final StringBuilder msg = new StringBuilder("Prosím zadejte ");
            msg.append(odd ? "liché " : "").append("prvočíslo.");
            error(inputField, mainFrame, msg.toString());
            return null;
        }
    }