Java JTextPane Save

别等时光非礼了梦想. 提交于 2019-12-08 12:13:50

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/2723073/java-jtextpane-save

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!