Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图使用 JEditorPane 进行一些简单的文本格式化,但随着知识的增长,我发现 JTextPane 更易于实现且更健壮。
我的查询是如何将 JTextPane 中的格式化文本保存到文件中?它应该是 RTF 或 HTML 或其他 .. 因为该文件不会再次被应用程序打开。
它是一个带有格式化文本的聊天记录文本文件。
谢谢你。
您有来自 StyledEditorKit 的 HTML 和 RTF 编写方法。请参阅HTMLEditorKit.write和 RTFEditorKit