Here you can find the source of getIntegerInput(String message)
public static int getIntegerInput(String message)
//package com.java2s; /**//from www .ja v a 2 s.co m * You should have received a copy of the GNU General Public License version 3 * along with this work; Please find the Copyright information and Terms and * Conditions in the ClientLauncher.java or ServerLauncher.java file. */ import javax.swing.JOptionPane; public class Main { public static int getIntegerInput(String message) { int input = 0; while (true) { boolean check = true; try { input = Integer.parseInt(JOptionPane.showInputDialog(null, message, "")); } catch (NumberFormatException e) { check = false; } if (check == true) break; } return input; } }