Best way to block KeyEvent

Lubomir Nerad lubomir.nerad at
Wed Jun 27 09:12:47 PDT 2012

Hi Jiri,

you can consume key events for blocked keys in an event filter. Event 
filter is an EventHandler registered through addEventFilter method. It 
can be registered directly on the focused node or on any of its parent 
nodes, scene or stage.


                              new EventHandler<KeyEvent>() {
                                  public void handle(KeyEvent keyEvent) {
                                      if (<key test>) {

For <key test> you can use the KeyCombination.match method.


On 6/27/2012 5:28 PM, goddard at wrote:
> Hello,
> what's the best way to block KeyEvent? Let's say I want to have "enabled" only one key at a time in a set of keys.
> Regards, Jiri

More information about the openjfx-dev mailing list