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!

Prevent default behavior of events

cshNov 16 2011 — edited Nov 17 2011
How can I prevent the default behavior of events?

I know this concept from JavaScript or ActionScript where you could prevent the default behavior of an event by calling e.preventDefault().

How can I achieve this in JavaFX?

E.g. I have a KeyEvent on a TextArea and want to catch the Enter key and prevent it from positioning the cursor in the new line.

I tried consume(), but it seems, it is the equivalent to e.stopPropagation().
This post has been answered by jsmith on Nov 16 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2011
Added on Nov 16 2011
3 comments
951 views