java - Getting the current offset in the HTMLDocument of a JTextComponent -
in swing application i'm using jtextpane htmldocument backend. @ 1 point i'm inserting sort of placeholders programmatically document
document.insertstring(...)
for reason, using
htmleditorkit.inserthtml()
method doesn't make text appear in jtextpane.
what i'd know position i'm inserting in document, is, html document written in background. can
jtextpane.getcaretposition()
but gives me offset in document visible frontend, not resulting one.
it has no sence because result document's html text can different. e.g. end of line "\n" or "\r\n" depending on os , jvm settings. html skips e.g. double spaces or spaces between tags. 2 tags without space between them , line break between them has same offset in document. can add custom tag specific id , search result document's html text id.
Comments
Post a Comment