title: How to have a default value on a jTextField that is being validated?
body: <p>I want to validate the input of a jTextField and also have a default value set. From what I understand, this code should work, but the default value never appears. If I remove the validation code, the default value appears as it should. Is there a way that I can have my input validation AND have a default value also? </p>
  
  <pre><code>   myInput.setDocument(new javax.swing.text.PlainDocument(){
          @Override
          public void insertString(int offs, String str, javax.swing.text.AttributeSet a)
          throws javax.swing.text.BadLocationException {
              if((getLength() + str.length()) &lt;= 15
                  &amp;&amp; str.matches("[0-9\\.]"))
              super.insertString(offs, str, a);
          }
      });
      myInput.setText("127.0.0.1");
  </code></pre>