Focus on JTextField

kunju's Avatar
Light Poster
hello,

How can I set the cursor at the desired TextField? By defualt it sets in the
first TextField. I want to set in to the secon TextField?What is the method
using in Java? like any setFocuse()?

pls reply..
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
You need to call requestFocus() on the JTextField.
0
Amit Ray's Avatar, Join Date: Jul 2004
Contributor
Please look at requestFocus and requestFocusInWindow methods of the JComponent from the Java API docs : Focus Request Methods .

It is generally advised to use the later and avoid the requestFocus method whenever possible.

Amit Ray.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Quote:
Originally Posted by Amit Ray
It is generally advised to use the later and avoid the requestFocus method whenever possible.
Because there seems to have a bug in the requestFocus system http://bugs.sun.com/bugdatabase/view...bug_id=4449624