Obtenha a posição do cursor na textarea java

int currentCaretPosition = textPane.getCaretPosition();
Strange Seahorse