title: Values not clearing in JFormattedTextField
body: <p>I am finding it hard to clear the value of <code>JFormattedTextField</code>s. How to do it?</p>
  
  <p>I tried </p>
  
  <pre><code>txtJFormattedTextField.setText("");
  </code></pre>
  
  <p>But when focus is lost again the value that I cleared away will appear. I read the API regarding this issue.</p>
  
  <p>My factory for creating JTFormattedTextFields for Date fields is below -</p>
  
  <pre><code>public static JFormattedTextField createDateField() {
          MaskFormatter maskFormatter = null;
          try {
              maskFormatter = new MaskFormatter("##/##/####");
          } catch (ParseException e) {
              e.printStackTrace();
          }
          JFormattedTextField formattedTextField = new JFormattedTextField(
                  maskFormatter);
          SwingHelper.installDateValidation((AbstractDocument) formattedTextField
                  .getDocument());
          formattedTextField.setColumns(10);
          return formattedTextField;
      }
  </code></pre>
  
  <p>Tried the </p>
  
  <pre><code>try {
      ((JFormattedTextField) txtSigninDate).commitEdit();
  } catch (ParseException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>The result was an exception - below is the exception trace.</p>
  
  <pre><code>java.text.ParseException: stringToValue passed invalid value
      at javax.swing.text.MaskFormatter.stringToValue(MaskFormatter.java:456)
      at javax.swing.text.MaskFormatter.stringToValue(MaskFormatter.java:371)
      at javax.swing.JFormattedTextField.commitEdit(JFormattedTextField.java:530)
      at app.view.action.Authentication_Action.clearSigninFields(Authentication_Action.java:207)
      at app.view.action.authentication.AuthenticationCommand.decorateSignout(AuthenticationCommand.java:285)
      at app.view.action.authentication.AuthenticationCommand.executeSignin(AuthenticationCommand.java:122)
      at app.view.action.Authentication_Action$2.actionPerformed(Authentication_Action.java:292)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
  </code></pre>