Pular para o conteúdo principal

Postagens

Mostrando postagens com o rótulo quickpost

A generic handler for all input events in JavaFX 2

The JavaFX API is really complete and sometimes I find new possibilities with it. This is a small blog post to describe what I recently did with the event handling part of the JavaFX API. Update:   Jonathan Giles pointed that we can add a handler  to all kind of events with one single line instead call setOn* multiple times:  lbl.addEventHandler( MouseEvent.ANY, eventHandler) One handler to all Events I'm creating a sample application for my portuguese blog about JavaFX basics and I was exploring the Event class to find the best way to create an event handler to demonstrate all Node's possible event input handlers.(or the most famous one) I found that the event object has an attribute of type EventType and all the events implementations contains a String representation of that event. It can be done checking, for example, the MouseEvent class source code. With this I created only one class to handle all the events on my sample program. I think it might be useful...