Instead of use setOnKeyPressed, now I'm using addEventFilter:
private void adicionarProcessadorEventoEnterPressionado(Node elemento) {
if(elemento instanceof Pane){
Pane painel= (Pane) elemento;
for(Node filho :painel.getChildren()){
if(filho instanceof TextField || filho instanceof ComboBox || filho instanceof CheckBox
|| filho instanceof DatePicker || filho instanceof BigDecimalField)
filho.addEventFilter(KeyEvent.KEY_PRESSED,processadorEnterEmCampo);
else if(filho instanceof Button)
filho.setOnKeyPressed(processadorEnterEmBotao);
else
adicionarProcessadorEventoEnterPressionado(filho);
}
}
}
As I was suspecting that the implementation of the components was consuming the event before it gets to the handler, addEventFilter was the best bet:
The filter is called when the node receives an Event of the specified type during the capturing phase of event delivery.