Detecting every MouseEvent in JavaFx scene -


i want detect every mouseevent in javafx scene, mouse clicks. following solution works clicks, on controls not every control. question is, there way detect every mousereleased event on nodes of scene?

scene.addeventhandler(mouseevent.any, (eventhandler<mouseevent>) event -> {     eventtarget comp = event.gettarget();     logger.debug("## " + (comp != null ? comp.getclass().getsimplename() : event.getclass().getsimplename()) + " [" + event.geteventtype() + "] ## komponente: " + event.gettarget() + " --------> details:" + event); }); 

following @james_d suggestion, logging working. catch events, necessary use eventfilter because eventhandler missing event consumed. doc explains differences:

addeventfilter
registers event filter scene. filter called when scene receives event of specified type during capturing phase of event delivery.

addeventhandler
registers event handler scene. handler called when scene receives event of specified type during bubbling phase of event delivery.

a working code example:

scene.addeventfilter(mouseevent.mouse_released, (eventhandler<mouseevent>) event -> {     eventtarget comp = event.gettarget();     logger.debug("## " + (comp != null ? comp.getclass().getsimplename() : event.getclass().getsimplename()) + " [" + event.geteventtype() + "] ## komponente: " + event.gettarget() + " --------> details:" + event); }); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -