JavaFX: what is the difference between EventHandler and EventFilter?
I've been searching for some time and I found that basically, some web pages say there's no big difference Except for some points:
>EventFilter is executed before EventHandler > EventFilter is not sensitive to events Consume(); Let me see if I understand: let me say:
Button B = new button ("test"); b.addEventHandler(…..) {…}; b.addEventFilter(……){…};
Suppose they are all "linked" to a mouseevent MOUSE_ CLICKED; Then, the code of EventFilter will be the first to be executed!
Let's say that now I have:
Button b= new Button("Test"); b.addEventHandler(.....); b.addEventFilter(......){ //some code event.consume(); }; // First filter b.addEventFilter(......){ //some other code event.consume(); }; // Second filter
In this case, blog eventfilters will be executed, but EventHandler will not yes?
Is there anything else to know? In some cases, should I recommend one or others? Do I sometimes use them together to solve some problems?
thank you!
Solution
I don't understand your problem at all, but I found this in the Oracle document:
The main difference between filters and handlers is each execution time
https://docs.oracle.com/javafx/2/events/processing.htm