How do you set a focus on JTextField in Swing?

Viewed 85975

I created a form using Swing in Java. In the form I have used a JTextField on which I have to set the focus whenever I press a key. How do I set focus on a particular component in Swing?

5 Answers
Related