title: JFormattedTextField : input time duration value
body: <p>I want to use a <code>JFormattedTextField</code> to allow the user to input time <em>duration</em> values into a form. Sample valid values are:</p>
  
  <p><code>2h 30m</code><br>
  <code>72h 15m</code><br>
  <code>6h</code><br>
  <code>0h</code></p>
  
  <p>However I am having limited success with this. Can some one please suggest how this can be accomplished? I am OK if this result can be achieved using a <code>JTextField</code> as well.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>If it is worth anything, here's my current attempt:</p>
  
  <pre><code> mFormattedText.setFormatterFactory(
      new DefaultFormatterFactory(
          new DateFormatter(
              new SimpleDateFormat("H mm"))));
  </code></pre>
  
  <p>This sorta works except that:</p>
  
  <ul>
  <li><strike>I cannot get <code>h</code> and <code>m</code> to appear as plain text (I tried escaping)</strike> *</li>
  <li>The number of hours has a max</li>
  </ul>
  
  <p>*: See @nanda's answer</p>