• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

displaying multiple lines of text in JTextArea

 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
consider the code of displaying multiple lines of text in jtext area,how can i
display multiple lines of text,this code just displays the last string which is "ae", i need output to be displayed like following:
abc
de
asd
ae



thanks for support
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try something like
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the logic is wrong. You can do something like this.

There are many ways to achieve this. The example shown above is just an example.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextArea has an append method which can be used as well:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic