Hi all,
I'm trying to implement a kind of an intelliscence or autocomplete for when the user is typing inside a jTextField.
To do this I want to create a
popup menu which will show directly beneath the caret of the text field - this pop up menu will display the different options for the user to chose from to complete what he's typing.
I searched for solutions for this kind of problem and found this:
[http://forums.sun.com/thread.jspa?threadID=5443811]
The suggested solution in this link looks very close to what I need, with only one problem -
when using this line:
Rectangle r = textArea.modelToView( textArea.getCaretPosition() );
the X and Y positions that I get into r, are relative to the textfield itself and not for the
position of the caret on screen as I need it, and because of this when I show the popup menu at these coordinates, it doesn't show where I want it - directly beneath the caret.
I guess my bottom line question is: How can I get the position of the caret
on screen?
Thanks a lot to anyone who can help :)