Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTextArea does not recognize hex 0A as new line.

807580Sep 15 2010 — edited Sep 15 2010
Hi,

I am populating a JTextArea with the contents of a file in the form of a string.
It seems like that the JTextArea has problems recognizing hex 0A as new line, so all lines end up on one single line in the JTextArea.

How can I replace hex 0A with for instance '\n' ?

I have tried to use replaceAll("\\r", "\n") and replaceAll("\r", "\n") on the string before populating the JTextArea, but it just does not work.

Thanks for any help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2010
Added on Sep 15 2010
2 comments
421 views