Java JOptionPane Message getStringInput(String message)

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

Description

get String Input

License

Open Source License

Declaration

public static String getStringInput(String message) 

Method Source Code

//package com.java2s;
/**//  w w w  . j  av  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 String getStringInput(String message) {
        String input;
        while (true) {
            input = (String) JOptionPane.showInputDialog(null, message, "");
            if (input != null && input.trim().length() != 0)
                break;
        }
        return input;
    }

    public static String getStringInput(String message, String initialValue) {
        String input;
        while (true) {
            input = (String) JOptionPane.showInputDialog(null, message, initialValue);
            if (input != null && input.trim().length() != 0)
                break;
        }
        return input;
    }
}

Related

  1. getIntegerFromImput(String message, int min, int max)
  2. getIntegerInput(String message)
  3. getJOptionPaneIcon(int jOptionPaneMessageType)
  4. getPassword(String message)
  5. getString(Component component, String message)
  6. getStrInPane(String message, String title)
  7. getUserInputString(String message)
  8. globalMessagebox(String body, String title, int icon)
  9. input(Component comp, String title, String message, Object def)