Home > database >  Break string in Javax.Swing.JTextArea without escape characters
Break string in Javax.Swing.JTextArea without escape characters

Time:10-30

Is there a way to automatically break a string entered into JTextArea (in package javax.swing), for example via the keyboard, into a readable form, without the need for escape characters, i.e. \n and \r ?

Edit2:

With the help of @matt, I realized that the correct question is about word warp and therefore the answer is the answer function

mytextArea.setLineWrap(true);

CodePudding user response:

Breaking a string onto a newline without actually adding a character is a word wrap.

JTextArea has word wrap.

mytextArea.setLineWrap(true);
  • Related