code: public boolean tryScrollToReference(String reference)
      {
          Element dst = findElementToScroll(reference, getDocument().getDefaultRootElement());
          if (dst != null)
          {
              try
              {
                  Rectangle bottom = new Rectangle(0, getHeight() - 1, 1, 1);
                  Rectangle rec = modelToView(dst.getStartOffset());
                  if (rec != null)
                  {
                      scrollRectToVisible(bottom); //move to the bottom and back in order to put the reference to the window top
                      scrollRectToVisible(rec);
                  }
                  return true;
              } catch (BadLocationException e)
              {
                  UIManager.getLookAndFeel().provideErrorFeedback(this);
                  return false;
              }
          }
          else
              return false;
      }
docs: This method has the same purpose as {@link BrowserPane#scrollToReference(String)}.
  However, it allows checking whether the reference exists in the document.
  @param reference the named location to scroll to
  @return <code>true</code> when the location exists in the document, <code>false</code> when not found.