本文介绍了Java JTextPane保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用JEditorPane进行一些简单的文本格式设置,但是随着知识的增长,我发现JTextPane更易于实现且更强大.

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.

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

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.

谢谢.

推荐答案

您已经从StyledEditorKit中为HTML和RTF编写了方法.请参见 HTMLEditorKit.write 和RTFEditorKit

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

这篇关于Java JTextPane保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:20