• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make JScrollPane autoscroll down on a JTextArea ?  RSS feed

 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've built a chat application ,
problem is that when the application appends the chat string to the text area the JScrollPane doesn't automatically scroll down in order for the entered text to be shown.
What is the solution ?

Thanks in advanced guys
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
textArea.setCaretPosition(textArea.getDocument().getLength());
 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael , You saved me a lot of trouble man , Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!