0

I have a JavaFX scene with a stackPane. The first child (foremost) is a simple Pane to add some ImageView, the second (backmost) is a grid representing my playground. When I hover a grid case with my mouse, the case changes of color. For that, I had to set the setMouseTransparent of my Pane to true, else the grid don't take MouseEntered/Exited event. Sometime, I display an image in my Pane, and I wish could trigger an action by clicking on it but like the setMouseTransparent is true, I can't... I would like to know if there is a way to be able to do that only the children of the Pane (without this last so) can take the event !

Here my playground with a case :

enter image description here

And the tree of my nodes in SceneBuilder :

enter image description here

Thanks for your help :)

Oromis
  • 196
  • 2
  • 13
  • Would adding the children to the `GridPane` be an option (provided you can choose absolute positions)? – fabian Nov 25 '18 at 00:04
  • JavaFx offers comprehensive event-propagation controls. See [this](https://stackoverflow.com/a/47393040/3992939) explanation and some more relevant questions and answers [1](https://stackoverflow.com/questions/24510845/stackpane-mouseclick-to-be-listened-by-both-its-children) , [2](https://stackoverflow.com/questions/15248716/javafx-2-event-dispatching-to-underlying-nodes), [3](https://stackoverflow.com/questions/19498867/javafx-event-interception-consumption). For more help please post [mcve] – c0der Nov 25 '18 at 07:09

0 Answers0