Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Focus on JTextField (http://www.go4expert.com/forums/focus-on-jtextfield-t678/)

kunju 3Apr2006 00:29

Focus on JTextField
 
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..

coderzone 3Apr2006 07:29

Re: Focus on JTextField
 
You need to call requestFocus() on the JTextField.

Amit Ray 4Apr2006 13:03

Re: Focus on JTextField
 
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.

coderzone 4Apr2006 19:00

Re: Focus on JTextField
 
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


All times are GMT +5.5. The time now is 20:08.