Chapter 3: Control Statements

When a button is clicked, the method returns no option value. The value is JOptionPane.YES_OPTION(0) for the Yes button. JOptionPane.NO_OPTION(1) for the No button, and JOptionPane.CANCEL.OPTION(2) for the Cancel button. For example, the following loop continues to execute until the user clicks the No or Cancel button. int option = 0; ................
................