简体   繁体   中英

JTextArea wrap line with CR LF

I want to read a file and wrap its lines into a JTextArea when the reading encounter a CR LF value.

JTextArea has methods like setLineWrap and setWrapStyleWord that doesn't do that!

Thanks.

Just replace CRLF with \\n

The Linewrapping methods you mentioned are something slightly different - they wrap lines that are too long to fit into the JTextArea.

\\r (CR) wont line feed (LF) .
\\n (LF) will line feed.
\\r\\n (CRLF) will line feed.

so odd that jTextArea doesn't provide a configuration option for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM