views:

313

answers:

2

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 ?

+1  A: 

The book publisher Manning offers a free download of the first edition of "Swing" by Matthew Robinson and Pavel Vorobiev at http://www.manning.com/robinson2. (Scroll down the page looking for the link "Download Complete Swing Book (MS Word 97).")

Chapter 20 talks about developing a WYSIWYG RTF editor using a JTextPane as part of the editing component. The new version of the book is revised and describes the creation of a WYSIWYG HTML editor, but it is not free. (Despite what the page at the link says, the paper copy of the new edition does not appear to be available, but the eBook is, if you're interested.)

This was a great resource for me when I was trying to do something similar.

clartaq
A: 

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 surce pane.

Regards, Stas

StanislavL