title: Accept only numbers and a dot in Java TextField
body: <p>I've got one textField where I only accept numbers from the keyboard, but now I have to change it as it's a "price textField" and I would also need to accept a dot "." for any kind of prices.</p>
  
  <p>How can I change this in order to get what I need?</p>
  
  <pre><code>ptoMinimoField = new JTextField();
          ptoMinimoField.setBounds(348, 177, 167, 20);
          contentPanel.add(ptoMinimoField);
          ptoMinimoField.setColumns(10);
          ptoMinimoField.addKeyListener(new KeyAdapter() {
              public void keyTyped(KeyEvent e) {
                  char caracter = e.getKeyChar();
                  if (((caracter &lt; '0') || (caracter &gt; '9'))
                          &amp;&amp; (caracter != '\b')) {
                      e.consume();
                  }
              }
          });
  </code></pre>