Event Filtering

Scott Palmer swpalmer at gmail.com
Sat Feb 7 00:33:29 UTC 2015

Is it possible to modify the event in an event filter or otherwise tweak
the event that is ultimately received by the target?

Let's say I have a TextField and I only want to allow typing of capital
letters.  That is easy enough to enforce with an event filter.. if the
KeyTyped event doesn't represent a capital letter I can consume it in an
event filter and it won't get to the control.

But let's say that I want to allow the user to type lowercase letters and
have them appear in uppercase.  I don't ever want the text property of the
TextField to hold a lowercase character.  Can that be done?

There are no public constructors for KeyEvents, and the fields are
immutable.  So it doesn't seem like I can change the event that is
delivered to the target.  (What are the copyFor(...) methods on Event used

I suppose the 8u40 support for formatted fields is what should be used for
my example, but the idea of tweaking the events before they are delivered
to an event handler, or synthesizing a new event is more general.  Is it


More information about the openjfx-dev mailing list