Java examples for Swing:JOptionPane
Ask the user to enter some text about JOptionPane
import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String response = JOptionPane .showInputDialog("Please enter your opinion about input dialog."); if (response == null) { System.out.println("You have cancelled the input dialog."); } else {//from w w w .j a v a 2 s .co m System.out.println("You entered: " + response); } } }