I have:
HTMLDocument document = new HTMLDocument();
JTextPane htmlEditorPane = new JTextPane(document)
htmlEditorPane.setContentType("text/html");
I then select some text in the middle of a sentence and call (wrapped in the appropriate ActionListeners):
htmlEditorPane.copy();
htmlEditorPane.paste();
For whatever reason whenever I do this the text that is copy and pasted is wrapped in <p>
tags. How can I keep all the formatting but the <p>
tags that seem to be added?