get cursor position in textarea java

Java
int currentCaretPosition = textPane.getCaretPosition();

Source

Also in Java: