How to make JTextPane line break [duplicate]

只谈情不闲聊 提交于 2019-11-28 09:35:36

问题


This question already has an answer here:

  • JTextPane does not go to a new line? 3 answers

In Java Swing, The JTextPane do have word wrap when text exceeded width, but it does NOT line break for if there was a very long non-space string

How can I making line break for long non-space string in JTextPane?

Any ideas would be much appreciated, thanks.


回答1:


To allow letter wrap LabelView should be modified to override min width

java-sl.com/tip_letter_wrap_java7.html you have to define min width for label view = 0

Also this java-sl.com/tip_java7_text_wrapping_bug_fix.html could help

Posted as answer from comment



来源:https://stackoverflow.com/questions/23883475/how-to-make-jtextpane-line-break

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