Dikei Dikei - 1 year ago 113
Java Question

How to copy styled text in JTextPane

I'm trying to create a WYSIWYG editor using 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 ?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download