• Post Reply Bookmark Topic Watch Topic
  • New Topic

jTextArea question  RSS feed

 
Maysam Sorkhabi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am developing a chat client. I have a JTextArea that displays incoming messages as well as my own messages. I want it to keep up with the text but it
does not automatically scroll with text and it does not keep up. Now I dont mean that it does not scroll at all, rather why it falls behind after a while. I have it inside a JScrollPane and it works quite fine except for this little issue. How can I have this textArea or perhaps ScrolPane scroll simultaneously with text and not fall behind. (So that as it scrolls always the LAST line of text is shown)
thank you very much for your help.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the event code where you append text into the JTextArea call

after the text update. The Document interface is in the javax.swing.text package.
 
Maysam Sorkhabi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Craig...You're the best!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!