如何在JTextPane中复制样式文本 [英] How to copy styled text in JTextPane

查看:210
本文介绍了如何在JTextPane中复制样式文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用JTextPane创建一个WYSIWYG编辑器。

I'm trying to create a WYSIWYG editor using JTextPane.

我使用DefaultEditorKit.CopyAction在编辑器中复制文本。但是这种方法不保留文本的样式。有人可以告诉我如何复制JTextPane中的文本和保留风格,请吗?

I'm using DefaultEditorKit.CopyAction to copy text in the editor. But this method does not preserve the style of the text. Can someone tell me how to copy the text in JTextPane and preserve the style, please ?

推荐答案

http://java-sl.com/tip_merge_documents.html
您可以使用此。如果您需要文档的一部分,只需选择源窗格的所需片段。

http://java-sl.com/tip_merge_documents.html You can use this. If you need part of the document just select desired fragment of the source pane.

这篇关于如何在JTextPane中复制样式文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆