得到光标在第几个字符处 getCaretPosition();
int c=textArea.getCaretPosition();
int line = textArea.getLineOfOffset(c) + 1; //行
int col = c - textArea.getLineStartOffset(line-1) + 1;//列
得到光标在第几个字符处 getCaretPosition();
int c=textArea.getCaretPosition();
int line = textArea.getLineOfOffset(c) + 1; //行
int col = c - textArea.getLineStartOffset(line-1) + 1;//列
转载于:https://my.oschina.net/csmw00/blog/717370