This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scrolling a JTextPane within a JScrollPane

 
Robert Miller
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem which seems so elementary that I'm embarrassed to bring it up, but I can't find the solution through the javadocs or my other resources.

I have a JTextPane which I am using to display data, output only. I am placing it in a JScrollPane. What I want to do is have it scroll to the bottom when I add text to it. Manually setting the vertical scroll bar to its maximum value doesn't seem to work.

Can anyone help me with this?

Thanks!
 
Charles Dupin
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may try to work with the viewport.
Check this:
http://javaalmanac.com/egs/javax.swing.table/Vis.html?l=rel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic