Hi,
I have a JTextField, and I have text in it. For example the string
“example text”.
The user can position the curser in the JTextField for example between p
and l.
My problem: I need a method that gives me the position of the cursor in
the JTextField. For the example the method should return 5, because the
cursor is positioned behind the 5th letter (the p).
How should such a method look like? Or how in principle can I do this?
Thanks!
Andrew Thompson - 30 Jun 2005 20:56 GMT
> My problem: I need a method that gives me the position of the cursor in
> the JTextField.
Sounds like you are after the 'caret'..
JTextField.getCaretPosition()
HTH

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane