I have a JTextPane inside a JScrollPane. This text pane is displaying an HTML document. I've implemented a search function that gives me an offset in the string backing the text pane. I'd like to scroll to this offset. This is what I'm currently doing...
Rectangle r = txtPane.modelToView(myIntOffset);
txtPane.scrollRectToVisible(r);
This always scrolls to the very bottom of the document, even if I hard code what is passed to scrollRectToVisible. Any ideas?