private int askNumber(String type, String text, int max) {
        try {
            String txt = JOptionPane.showInputDialog("Inserte numero de " + type + " para " + text + " :");
            int num = Integer.parseInt(txt);
            if (num > 10 || num < 0)
                throw new RuntimeException();
            return num;
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, ERROR_INT);
            return askNumber(type, text, max);
        }
    }