title: form validation not working correctly
body: <p>I am writing a simple GUI using netbeans and Java SE, i cannot seem to get input validation to work correctly. I have a JTextField and 2 JPasswordField objects, I want to check that any of these fields arent empty when the user hits the submit button. It works properly for the password fields if they are left empty, however if i input something into the username field, it prints data has been submitted, when the other form elements have not been filled with data. Here is the code below, any assistance would be greatly appreciated....</p>
  
  <pre><code>// test that none of the fields are empty before submitting form data
  if (!username_input.getText().isEmpty() &amp;&amp; !password_input1.getPassword().toString().isEmpty() 
                  &amp;&amp; !password_input2.getPassword().toString().isEmpty())
          {
              System.out.println("Data has been submitted!");
          }
          else
          {
              System.out.println("Form has not been filled in correctly!\nPlease try again");
          }
  </code></pre>