java - edit html content in JEditorPane -


i need i'm trying 1 month using various approaches... unsuccessfully.

i have jtextpane containing html text images, etc. works perfectly.

now, have id of < span > < /span > element , want delete it's content , insert component instead.

more concretely, have : < span id='123' >< img src='url/123.png' / >< /span > , want have < span id='123' >#jlabel< /span >

i know how :

  • get span element : htmldoc.getelement("123");
  • insert jlabel in jtextpane @ caret position : jtp.insertcomponent(component);

i have no idea how can :

  • delete < img / >
  • insert component @ proper position.

thank !

you know how span element maybe following work:

  1. the element class has getstartoffset() method might able use insert jlabel.

  2. take @ htmldocument class. there remove(element) method.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -