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