Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextArea line break  RSS feed

 
Filipe Marques
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would to like to set the line separator between two lines.
I've got a non editable JTextArea and I do not want words compounded with a space character to be in two separated lines.
Instead, I would like to set 3 spaces for a line separator.

I suppose I have to redefine the behaviour of word wrapping... But how ?
 
Brian Cole
Author
Ranch Hand
Posts: 947
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Filipe Abalada:
I would to like to set the line separator between two lines.
I've got a non editable JTextArea and I do not want words compounded with a space character to be in two separated lines.
Instead, I would like to set 3 spaces for a line separator.

I suppose I have to redefine the behaviour of word wrapping... But how ?


Probably easiest would be to turn the JTextArea's line wrapping off and manually replace substrings of three spaces with newline characters.
 
Filipe Marques
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a good idea.
Thank you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!