使用HTMLDocument在JTextPane中启用自动换行 [英] Enabling word wrap in a JTextPane with HTMLDocument
问题描述
无处不在,我找到了寻找启用封装在 JTextPane
中的方法的答案,但它们都不适合我。我正在使用 HTMLDocument
(显示text / html
内容),而目前为止我没有发现任何内容得到它的工作。 JTextPane
总是使JScrollPane水平滚动。我需要JTextPane是可滚动的,但仅限于垂直。
Everywhere I read answers of people finding ways of enabling word wrapping in a JTextPane
, but none of them work for me. I'm using an HTMLDocument
(to display "text/html"
content) and nothing that I have found so far got it to work. The JTextPane
always cause the JScrollPane to scroll horizontally. I need the JTextPane to be scrollable, but only vertically.
任何人都可以有一个可行的单词演示包装 JTextPane
显示HTML内容?
Would anyone have a workable demo of a word wrapping JTextPane
displaying HTML content?
推荐答案
以此为例来实现自定义换行(无论您需要什么)
http://java-sl.com/tip_html_letter_wrap.html
Use this as example to implement custom wrap (whatever you need) http://java-sl.com/tip_html_letter_wrap.html
这篇关于使用HTMLDocument在JTextPane中启用自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!