public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr)
     throws BadLocationException {
   StringBuilder builder = new StringBuilder(string);
   // 过滤用户输入的所有字符
   filterInt(builder);
   super.insertString(fb, offset, builder.toString(), attr);
 }
 public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr)
     throws BadLocationException {
   if (string != null) {
     StringBuilder builder = new StringBuilder(string);
     // 过滤用户替换的所有字符
     filterInt(builder);
     string = builder.toString();
   }
   super.replace(fb, offset, length, string, attr);
 }