code: public void caretUpdate(CaretEvent e)
  	{
  		resetHighlight();
  		try {
  			this.currentLine = getLineOfOffset(e.getDot());
  			//System.out.println(getCurrentLine());
  		}
  		catch (BadLocationException e1) { e1.printStackTrace(); }
  				
  		//int line = getLineOfOffset(tp, dot);
  	    //int positionInLine = dot - getLineStartOffset(tp, line);
  	}
docs: Implement CaretListener