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

Discussion in 'Java' started by Robin, May 12, 2005.

  1. Robin

    Robin Guest

    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
     
    Robin, May 12, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DaveR
    Replies:
    2
    Views:
    6,605
    Dave Rudlin
    Nov 17, 2004
  2. Stefan Istrate
    Replies:
    1
    Views:
    333
    TiloVillwock
    Apr 16, 2009
  3. Stefan Istrate
    Replies:
    0
    Views:
    863
    Stefan Istrate
    Apr 16, 2009
  4. Barry
    Replies:
    1
    Views:
    152
  5. brendan
    Replies:
    0
    Views:
    200
    brendan
    Aug 29, 2006
Loading...

Share This Page