JEditorPane (text/html) - determining position of caret in HTML source

R

Robin

Hi,

I'm using a JEditorPane to display HTML.

I need to know if it's possible to exactly determine in the HTML source
the current caret position is.

i.e if the JEditorPane is displaying:
hello world

and the caret is at position 3 (between the 2 'l's in hello), how can I
find the corresponding position in the HTML source - in this case the
HTML source would be "<html><head></head><body>hello
world</body></html>", and the value I need is 28.

Many thanks,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,258
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top