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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top