Pasting to JTextPane

Hi all....

I am trying to copy formatted/plain text from

1. OpenOffice2.0 word processor to JTextPane, but nothing is getting pasted in JTextPane.

2. Any of website and on pasting in JTextPane, some junk characters(box like character) are also getting pasted along with the copied text.

The code which i used is as below :-

publicclass TextPaneExmplextends JFrame{

JTextPane editor =null;

/** The reference object for HTMLEditorKit. */

publicstatic HTMLEditorKit editorKit =null;

/** The reference object for HTMLDocument. */

public HTMLDocument document =null;

JTextArea txtArea =null;

public TextPaneExmpl(){

editor =new JTextPane();

editor.setContentType("text/html");

editor.setEditable(true);

editorKit =new HTMLEditorKit();

document = (HTMLDocument) editorKit.createDefaultDocument();

editor.setEditorKit(editorKit);

editor.setDocument(document);

getContentPane().add(editor, BorderLayout.CENTER);

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

setSize(800, 600);

setVisible(true);

}

publicstaticvoid main(String[] args){

new TextPaneExmpl();

}

}

Can any one tell me whats the reason for thisOR is there any work around?

Sarjay

[2218 byte] By [Sarjaya] at [2007-11-27 9:22:40]
# 1

hi!

this is very interesting thing you are doing. now for this you have to understand the file formats. how they are present in binary-ascii-Unicode forms. read all those from google. you have to do a lot more home work before getting into these kind of project.

regards

Aniruddha

Aniruddha-Herea at 2007-7-12 22:17:17 > top of Java-index,Desktop,Core GUI APIs...