title: javafx textfield ip address
body: <p>I would like to make sure the user enter a valid IPv4 address in a JavaFX TextField (0.0.0.0 to 255.255.255.255) but i can't seems to find any valid solutions.</p>
  
  <p>I tried with that code : </p>
  
  <pre><code>    private final TextField serverURI = new TextField();
      final UnaryOperator&lt;TextFormatter.Change&gt; urlFilter = new UnaryOperator&lt;TextFormatter.Change&gt;() {
          @Override
          public TextFormatter.Change apply(TextFormatter.Change change) {
              final String text = change.getText();
              return (text.isEmpty() || text.matches("^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) ? change : null;
          }
      };
      final TextFormatter&lt;String&gt; urlFormatter = new TextFormatter(urlFilter);
      serverURI.setTextFormatter(urlFormatter);
  </code></pre>
  
  <p>But I can't even type one digit... It seems to work with only one input</p>