Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

scrollRectToVisible() doesn't work?

843806Jun 27 2007 — edited Jun 29 2007
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2007
Added on Jun 27 2007
17 comments
819 views