JTextArea myTextArea = new JTextArea(); myTextArea.setWrapStyleWord(true);
JTextArea myTextArea = new JTextArea(); myTextArea.setWrapStyleWord(false);This example creates a new JTextArea and sets its wrap style to break lines at any character boundary. In both examples, the package library used is javax.swing.