To obtain user input, using the showInputDialog method. The showInputDialog method has six overloads whose signatures are as follows.
public static java.lang.String showInputDialog (java.awt.Component parent, java.lang.Object message)
public static java.lang.String showInputDialog (java.awt.Component parent, java.lang.Object message, java.lang.Object initialSelectionValue)
public static java.lang.String showInputDialog (java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType)
public static java.lang.String showInputDialog (java.awt.Component parent, java.lang.Object message, java.lang.String title, int messageType, Icon icon, java.lang.Object[] selectionValues, java.lang.Object initialSelectionValue)
public static java.lang.String showInputDialog (java.lang.Object message)
public static java.lang.Object showInputDialog (java.lang.Object message, java.lang.Object intialSelectionValue)
The messageType argument specifies the type of the message, and its values is one of the following:
- JOptionPane.INFORMATION_MESSAGE
- JOptionPane.ERROR_MESSAGE
- JOptionPane.WARNING_MESSAGE
- JOptionPane.QUESTION_MESSAGE
- JOptionPane.PLAIN_MESSAGE
The selectionValues argument specifies an array of objects that provides possible selections.
The initialSelectionValue argument specifies the initial value in the input field.