Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Keeping the format of a text area  RSS feed

 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am reading in a textArea from a form and storing the value in a string. I am then concatanating this string with others to make a body of an email message that I am then sending out. The problem is that the string I get back from the textArea is not keeping the format it is all one big line. Is there anyway to maintain the format of the original textArea.

Thanks,

AMD
 
Paul Clapham
Sheriff
Posts: 22502
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that a Swing form or an HTML form? And how do you know you are getting "one big line" from the text area?
 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

When I System.out the string it is coming out as one long line. It works when I hit the returns in the textArea. It is only when it wraps itself in the textArea that I don't get the new lines. Not sure if I can fix that.

Thanks,

Andrew
 
Paul Clapham
Sheriff
Posts: 22502
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you can't fix that. And I don't think you should fix it either. When the text area wraps the text, it does that based on its current width and whatever font it's currently using. Changing either of those things could change where the wrapping occurs.

You'll notice for example that when you typed your question into the forum's text area, it wrapped the text as you typed. But that wrapping isn't preserved when the forum displays the question, is it? The question is re-wrapped to fit the page width. That's normal behaviour.
 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah I see Thanks

AMD
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!