I have JTextFieldinside a JPanelA, which is part CardLayout. When this A is shown, I want to automatically focus on JTextField(i.e., the cursor is blinking in the text box, so the user does not need to click on it to enable input). I tried to call the requestFocusInWindow()object JTextFieldduring initialization, but this does not work. Do I need to call this method every time A is displayed? Thank.
source
share