code: protected String getTextEx(int position, int len)
      {
          try {
              return getDocument().getText(position, len);
          } catch (BadLocationException e) {
              e.printStackTrace();
              return "";
          }
      }
docs: Gets the text.
  
  @param position
  the position, where to begin
  @param len
  the length of text portion
  @return the text