Java tutorial
import java.text.ParseException; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) throws ParseException { String input = JOptionPane.showInputDialog("Enter Input:"); if (input == null) { System.out.println("Calcel pressed"); } else { System.out.println("OK pressed"); } } }