...
>By "offsets" I mean the number of characters from the beginning of the
>document (including line feeds).
In that case, you might play with this example.
Mind you, I get a start position of '0' printed, which
makes it quite odd to me that both these operations
should effect the 'e', rather than the 's'.
<sscce>
import javax.swing.*;
class HTMLTextOffset {
public static void main(String[] args)
throws Exception {
String content = "<HTML>test</HTML>";
JEditorPane jep =
new JEditorPane("text/html", content);
jep.setEditable(false);
System.out.println(
jep.getDocument().getStartPosition() );
jep.setCaretPosition(2);
jep.moveCaretPosition(3);
JOptionPane.showMessageDialog( null, jep );
jep.setCaretPosition(0);
jep.getDocument().remove(2,1);
JOptionPane.showMessageDialog( null, jep );
}
}
</sscce>

Signature
Andrew Thompson
http://www.athompson.info/andrew/