import javax.swing.*;
public class JOptionPaneShowInputDialogExample
{
public static void main(String[] args)
{
JFrame frame = new JFrame("InputDialog Example");
// prompt the user to enter their name
String name = JOptionPane.showInputDialog(frame, "What's your name?");
// get the user's input. note that if they press Cancel, 'name' will be null
System.out.println("The user's name is "+ name);
System.exit(0);
}
}
0 comments: