You need to call requestFocus() on the JTextField.