code: public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException {
          if (str.equals("{"))
              str = addMatchingBrace(offset);
          super.insertString(offset, str, a);
          processChangedLines(offset, str.length());
      }
docs: /*
  Override to apply syntax highlighting after the document has been updated