JTextArea: how to wrap text by words, not characters?

前端 未结 3 1453
时光取名叫无心
时光取名叫无心 2021-01-07 16:44

I want to avoid an output like this:

Here is some text t
hat is being wrappe
d by characters, sp
litting words in ha
lf

I am using a JTextA

3条回答
  •  北海茫月
    2021-01-07 17:23

    You could just go to the properties window of the text field and check the boxes for both wrap style word and line wrap. It works like a charm

提交回复
热议问题