将JTextPane设置为内容类型HTML并使用字符串构建器

将JTextPane设置为内容类型HTML并使用字符串构建器,第1张

将JTextPane设置为内容类型HTML并使用字符串构建器

每次

JTextPane.setText(...)
被称为新的内容类型被确定。以开头的文本,
"<html>"
您已经有了HTML。

在您的情况下,将创建一个新文档HTMLdocument。


@mKorbel:每次JTextPane都将创建以下HTML。

    buildSomething.append("<html>");    buildSomething1.append("<html>");    for (int i = 0; i < 10; i++) {        buildSomething.append("<span style="color:red">" + myBirthday + "</span>");        buildSomething1.append("<b style="color:blue">" + myBirthday + "</b>");    }


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5130778.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-17
下一篇2022-11-17

发表评论

登录后才能评论

评论列表(0条)

    保存