Pls help: get cursor position in text area

hi can anyone pls help me with this…
I ve to get the character tat the mouse points to at the current position in textarea. im running the java code in netbeans.
The below code does the following

  • using file chooser we select a txt file from the system.
  • the txt file opens in the textarea.
  • the total words in txt file is counted n displayed in a label.
    now i want to get the character at the current mouse cursor position in the txt file tat is displayed on the textarea.

i ve attached my code…
but its not working as expected…i m not getting any error…but not able to get the position of the current cursor position.