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!

JTextArea inside JScrollPane, scroll to position on set text

800402Jul 21 2008 — edited Jul 21 2008
I have a JTextArea that I put inside JScrollPane during construction of the panel holding them. Elsewhere in the panel the user can click on various rows of a table that when clicked provide a description inside the JTextArea by calling it's setText(String). If the description is long enough the scroll pane bars appear and it automatically scrolls down to the bottom of the pane. If it's wide enough for the horizontal bar to show up it doesn't scroll that one (stays in lower left corner). This is not behavior I gave it, it's just doing it. Is there a way to force it to stay in the upper left corner regardless of what the contents are (whether by some call during construction or a call after every time I call setText on the JTextArea)? Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2008
Added on Jul 21 2008
2 comments
149 views