Java JTextPane 保存
我试图使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有来自 StyledEditorKit 的 HTML 和 RTF 编写方法。请参阅 HTMLEditorKit.write 和 RTFEditorKit
You have write method for HTML and RTF from StyledEditorKit. See HTMLEditorKit.write and RTFEditorKit