Reputation: 18068
Exacly as stated in the subject how to make JTextField lose its focus?
Something like:
jtf.setFocus(false)
Upvotes: 1
Views: 8139
Reputation: 329
If you don't want to transfer the focus use this:
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearFocusOwner();
Upvotes: 1
Reputation: 11
One can also focus on a panel so that it would look like no components were focused
jpanel1.requestFocusInWindow();
Upvotes: 0
Reputation: 159774
You could simply transfer focus to another component:
myOtherComponent.requestFocusInWindow();
Upvotes: 7