How to make a JTextField lose focus?

35 views
Skip to first unread message

Zdravko Beykov

unread,
Feb 19, 2013, 3:34:14 AM2/19/13
to aswing-...@googlegroups.com
Hello,
I would like to know how it's possible to make a JTextField lose focus when I press ENTER (the ACT event). I looked through the documentation but there is no such option. It doesn't work with dispatching FOCUS_LOST or transferFocus (it passes it to next textfield instead).

Thank you in advance.

Zdravko Beykov

unread,
Feb 19, 2013, 10:09:13 AM2/19/13
to aswing-...@googlegroups.com
Solved it, not too elegantly - I set the parent panel or another button that is child of the panel with .requestFocus();
Reply all
Reply to author
Forward
0 new messages