I am developing an application which have a JTextField, JButton and JTextArea in same JFrame. How do I set JTextField selected when JFrame starts.
How do I set JTextField selected when JFrame starts.
I assume you mean you want the text field to have
focus so you can start typing into it. ("Selected", in Swing terminology, means the text contained in the text field will be highlighted.)
The first component on the frame (top/left) will gain focus automatically.
If your text field isn't the first component then you can request focus with code like:
The key is that you need to make the focus request AFTER the frame is visible.