Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Programmatically unfocus a TextField?

990159Feb 14 2013 — edited Feb 14 2013
On my view I only have one editable content: Text in a TextField. The problem is that as a user one never gets rid of the focus (because there is nothing else to focus on), once the TextField is focused. I want to remove the focus from the TextField when the user presses Enter. I know how to react to the Enter key being pressed, but I don't know how to unfocus a control/TextField programmatically?

I got the hint to use http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#setFocused(boolean), but this method is protected and not public, so I can't call this method from the controller assigned to the view containing the TextField. Is this intended? Is there any other way for unfocusing a control in JavaFX 2?

Thanks for any hint!

Edited by: srynoname on 14.02.2013 12:47
This post has been answered by shakir.gusaroff on Feb 14 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2013
Added on Feb 14 2013
2 comments
9,344 views