Java JTextPane 保存

发布于 2024-08-30 07:06:49 字数 191 浏览 3 评论 0原文

我试图使用 JEditorPane 进行一些简单的文本格式化,但随着知识的增长,我发现 JTextPane 更容易实现并且更强大。

我的查询是如何将 JTextPane 中的格式化文本保存到文件?它应该是 RTF 或 HTML 或其他..,因为应用程序不会再次打开该文件。

它是带有格式化文本的聊天历史文本文件。

谢谢。

i was trying to do some simple text formatting using JEditorPane but then as knowledge grew i found JTextPane easier to implement and more robust.

my query is how do i save the formatted text in JTextPane to file? it should be RTF or HTML or other.. as this file is not opened by the application again.

it is a chat history text file with formatted text.

thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒眉千度 2024-09-06 07:06:49

您有来自 StyledEditorKit 的 HTML 和 RTF 编写方法。请参阅 HTMLEditorKit.write 和 RTFEditorKit

You have write method for HTML and RTF from StyledEditorKit. See HTMLEditorKit.write and RTFEditorKit

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文