使用HTMLDocument在JTextPane中启用自动换行 [英] Enabling word wrap in a JTextPane with HTMLDocument

查看:195
本文介绍了使用HTMLDocument在JTextPane中启用自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无处不在,我找到了寻找启用封装在 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

http://java-sl.com/wrap.html

这篇关于使用HTMLDocument在JTextPane中启用自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆