import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class InputDialog {
public static void main(String argv[]) {
String input = (String) JOptionPane.showInputDialog(
new JFrame(),
"Please enter your favorite Shakespeare play",
"Title", JOptionPane.INFORMATION_MESSAGE,
new ImageIcon("java2sLogo.GIF"), null, "Romeo and Juliet");
System.out.println("User's input: " + input);
}
}
|