Java JOptionPane Message getIntegerInput(String message)

Here you can find the source of getIntegerInput(String message)

Description

get Integer Input

License

Open Source License

Declaration

public static int getIntegerInput(String message) 

Method Source Code

//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;
    }
}

Related

  1. exibeMsg(String msg, int tipoMsg)
  2. getIconForType(int messageType)
  3. getInput(String msg, String defaultInput)
  4. getInt(String message, int min, int max, Integer initialValue)
  5. getIntegerFromImput(String message, int min, int max)
  6. getJOptionPaneIcon(int jOptionPaneMessageType)
  7. getPassword(String message)
  8. getString(Component component, String message)
  9. getStringInput(String message)