@Override
    public void replace(
        final DocumentFilter.FilterBypass fb,
        final int offset,
        final int length,
        final String string,
        final AttributeSet attr)
        throws BadLocationException {
      if (isValid(string, length)) {
        super.replace(fb, offset, length, string, attr);
      }
    }
Hex formatter that can be used to validate input for hexadecimal text fields. Taken from
http://forum.java.sun.com/thread.jspa?threadID=436233&messageID=3169976

<p>Slightly modified.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/CHexFormatter.java