I'm trying to develop an web-publishing applet
What I have done so far is :
1) Used a JEditorPane for the WYSIWYG-editor:
final JEditorPane editor = new JEditorPane();
2) Set this editor to text/html and editable:
What I now want to do is this:
1) Get cursor-position from this EditorPane. I have tried using Caret posisjon = editor.getCaret(); but this isn't right because "behind the scenes", the EditorPane consist of html-tags, so the returned position is wrong.That's what's most tricky here.
2) Second question is how to retreve the selected part of the text in the JEditPane and replace it. Example: If the user press the "B"-button, the text "Batalf" will be replaced with "<b>Batalf</b>". The <b>'tag will of course not show, Batalf will just be written in a bold font.
Hopefully anyone of you could help me out.
Thanks in advance.