As an unexpected (at least for me) behaviour, the editorpane.getText()method seems to returnthe size of the whole HTML source, while the setCaretPosition() only seemsto count the 'visible' text only (that is no tags or newlines).