How can I get the position of the mouse pointer in a TextArea so that I can insert a String at that position?

Sandip Chitale

The mouse position is represented by the caret in the text area. You can use the following code to insert at the caret position.

  new MouseAdapter() {
    public void mouseClicked(mouseEvent me) {
       // this should move the caret
       // now insert text
       textArea.insertText("TEXT TO INSERT"