the caret is not located inside the element or in the case of any other failure.
Text.getCaretOffset
int getCaretOffset()Gets the offset of the position of the caret (cursor).
Returns
the character offset of the position of the caret or -1 if
int getCaretOffset()Gets the offset of the position of the caret (cursor).
the caret is not located inside the element or in the case of any other failure.