Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Prepend text in JTextArea  RSS feed

 
ryan headley
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to PREPEND text in a JTextArea rather that APPEND it?
I want the most recent addtions of text in the JTextArea to be at the top, not the bottom.
I do have JTextArea in a JScrollPane, but I would rather have ppl scroll down to see old messages and have the new onese at the top...
Any ideas?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ryan,
Have a look at the insert method of JTextArea. Using position of zero should get the front.
Regards,
Manfred.
 
ryan headley
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx,
I will give that a try...
Ryan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!