title: how to check if user has input something or not in JDialogBox?
body: <p>I have created a custom dialog box which requires 3 fields</p>
  
  <pre><code>public class Test{
  
      public static void main(String args[])
  
      {
  
          JTextField firstName = new JTextField();
  
          JTextField lastName = new JTextField();
  
          JPasswordField password = new JPasswordField();
  
          final JComponent[] inputs = new JComponent[] {
  
                          new JLabel("First"),
  
                          firstName,
  
                          new JLabel("Last"),
  
                          lastName,
  
                          new JLabel("Password"),
  
                          password
  
          };
  
          JOptionPane.showMessageDialog(null, inputs, "My custom dialog",JOptionPane.PLAIN_MESSAGE);
  
          System.out.println("You entered " +firstName.getText() + ", " +lastName.getText() + ", " +password.getText());
  
      }
  }
  </code></pre>
  
  <p>How do I check if the user has inserted all fields or not? And even if user close the dialog box it display</p>
  
  <pre><code>You entered , , 
  </code></pre>
  
  <p>I want to check user input in field and close application if user close dialog box without dsplaying </p>
  
  <pre><code>"You entered , , "
  </code></pre>