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

一世执手 提交于 2019-12-01 02:07:12

JTextArea.setWrapStyleWord(true)?

If you want your text is wrapped by words and not by the characters ( in other words , if you want you half word also shifts to next line

Very simple just use wrapstyleword instead of linewrap Syntax - JTextArea.setwrapstyleword(true);

Note~ It can only be used when you linewrap is already true I hope it would help.

Source ~ My notebook

Credits - 49/51 { 49% to myself & 51% to my ip teachers Ms. Shalu }

~ AM 17

Eliizabeth

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!