Joke Collection Website - Blessing messages - Java, JTextArea, how to wrap words automatically?

Java, JTextArea, how to wrap words automatically?

TextArea has a method called setLineWrap (Boolean wrap). If this parameter is set to True, it can wrap automatically.

If you want each input to be a line break, add a "\r\n" at the end of the last input.

For example:

JTextArea.append ("input content"+"\ r \ n");

In this way, every typing is a new line.

You need to add \r\n, so that you can take the test, and then you can wrap the line after writing a paragraph.