title: How to define a formatted text field in Swing so that the format restrictions are applied as you type?
body: <p>I need such a numeric text field on JFrame  that </p>
  
  <ol>
  <li>restricts the input by a number with two digits after decimal
  point</li>
  <li>lays out the number separating  every three digits i.e. 1
  234 567,89. </li>
  <li>the number is displayed in correct format right away
  during typing</li>
  </ol>
  
  <p>I tried using JFormattedTextField:</p>
  
  <pre><code>    NumberFormat nf = NumberFormat.getNumberInstance();
      nf.setMaximumFractionDigits(2);
      NumberFormatter numFormater = new NumberFormatter(nf);
      field1 = new javax.swing.JFormattedTextField(numFormater);
  </code></pre>
  
  <p>However, format restricitions apply only when focus leaves the component, which is a problem. I want user to be able to type only digits and delimeter in the field, and a space delimeter be placed right after each 3-d digit is entered in the field. </p>
  
  <p>I can do this in C# just by specifing properties of the field. What is a clean way to do this in Swing? 
  Thank you.</p>