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!

EventHandler similar to onBlur event in TextField

Sai Pradeep DandemSep 23 2011 — edited Sep 27 2011
Hi,
I am trying to get an action event on TextField similar to "onblur" functionality in html.

I tried by declaring the setOnAction() method. But this is getting called only if I pressed the "enter" button.
Actually I want the event to fire as soon as on tab-out or the focus is out from the text field.

The code I am trying with is..
Text text = new TextField();
text.setOnAction(new EventHandler<ActionEvent>() {
       @Override
	public void handle(ActionEvent arg0) {
		System.out.println( text.getText() );
	}
});
This post has been answered by diverson on Sep 26 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2011
Added on Sep 23 2011
4 comments
2,076 views