Enabling Word-Wrapping and Line-Wrapping in a JTextArea Component

With line-wrapping, breaks are allowed to occur in the middle of words. With word-wrapping, breaks are only allowed between words.
JTextArea c = new JTextArea(); // Enable line-wrapping c.setLineWrap(true); c.setWrapStyleWord(false); // Enable word-wrapping c.setLineWrap(true); c.setWrapStyleWord(true);

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.