Java tutorial
import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String inputValue = JOptionPane.showInputDialog("Please input a value"); if (inputValue == null) { System.out.println("CANCEL"); } else if (inputValue.equals("")) { System.out.println("OK"); } else { JOptionPane.showMessageDialog(null, inputValue); } } }