title: JOptionPane Input Dialog
body: <p>Can someone enlighten me on java? The code below is just using JOptionPane and more on inputdialog box for getting data on the user.</p>
  
  <p>Concept:
  First option is to select transaction then if they press S another input dialog shows asking for a PIN and then after the PIN another input dialog shows with 4 options for example withdrawing,checking balance, depositing and exit.</p>
  
  <p>What is the process of showing another input dialog and then what is the process of going back to previous input dialog? And then what is the process of validating user input to show a message dialog first if the input is wrong and then go back to the previous input dialog?</p>
  
  <pre><code>import javax.swing.*;
  
  public class Main {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          String myOptions = "S = Select Transaction\n"
              + "Q = Quit\n"
              + "Enter your choice";
          String myPin = "Enter your PIN";
          String Y = "Yes";
          String N = "No";
          String value = JOptionPane.showInputDialog(
              null, myOptions, "Computerized Automatic Teller Machine", 1);
          if (value.equals("S")) {
              JOptionPane.showInputDialog(
                  null, myPin, "Computerized Automatic Teller Machine", 1);
          } else if (value.equals("Q")) {
              JOptionPane.showMessageDialog(
                  null, "Are you sure you want to exit?",
                  "Computerized Automatic Teller Machine", 1);
          } else {
              JOptionPane.showMessageDialog(
                  null, "Please the correct letter!",
                  "Computerized Automatic Teller Machine", 1);
              JOptionPane.showInputDialog(null, myOptions,
                  "Computerized Automatic Teller Machine", 1);
          }
      }
  }//end of class
  </code></pre>