0

I have a problem with JTextArea.

Screen:

enter image description here

JTextArea makes whole words splitted. Is it possible to change it?

Dennis Meng
  • 5,109
  • 14
  • 33
  • 36
Wicia
  • 575
  • 3
  • 9
  • 28
  • Whole words splitted? Where? Do you want to force the text to be together without spaces? Please specify your question. – Dropout Nov 25 '13 at 16:44
  • 1
    Welcome to SO. This has been answered several times already. Please do some research before asking. – m0skit0 Nov 25 '13 at 16:45
  • for example in 3rd line we have "browsin" and in the next line is lonely "g". – Wicia Nov 25 '13 at 16:46

2 Answers2

2

I think you want:

textArea.setWrapStyleWord(true);
hankd
  • 649
  • 3
  • 12
1

here is what you should do:

textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);

I took this information from http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • -1, this suggestion was given earlier. No need for a duplicate answer. – camickr Nov 25 '13 at 17:09
  • @camickr, other suggestion was given several seconds before mine. I have not removed mine because it contains additional information. – AlexR Nov 25 '13 at 20:00
  • It was given 3 minutes before you answered. If you thought it was a good idea then you can up vote and then add a comment if you think it needs additional information. This is how one good single answer is created. – camickr Nov 25 '13 at 20:05