event handling - How can I remove an EventFilter in JavaFX created with a lambda -
i able remove event filter set lambda. not sure if possible?
i have seen example using inner classes: http://www.java2s.com/tutorials/java/javafx/1120__javafx_event_filter.htm
however if create filter so:
addeventfilter(mouseevent.mouse_clicked, event -> { panewithselectionlistener parent = (panewithselectionlistener)getparent(); parent.selectannotation(this); enabletextediting(event); event.consume(); });
i able remove - can while using lambdas or need use inner classes?
thanks!
just store it:
eventhandler<mouseevent> myhandler = ...
then add filter:
addeventfilter(mouseevent.mouse_clicked, myhandler);
and later on remove it:
removeeventfilter(mouseevent.mouse_clicked, myhandler);
Comments
Post a Comment