Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prepend text in JTextArea

 
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