Pass through mouse clicks

Does anyone have a good method of passing through a click to objects behind the first? Basically I have a couple of layers of paintable canvases that draw items on themselves - I want to be able to click and check the first layer for something, if nothing to click then go to the next, etc.

I’m thinking right now to have a top layer that will individually query each paintable canvas via a custom function on each canvas, which I think would work alright, but I was wondering if there was any other method thats cleaner than this.

Look at Kyle’s suggestions here:


Probably just need some coordinate transformations to go the other way.

If you do, protip: https://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#convertPoint(java.awt.Component,%20int,%20int,%20java.awt.Component)

1 Like

Where has this been all my ignition life! Thanks, looks very nice.

Nice! Looks much better than my weird solution.

I thought I could switch some of the layers I had over to template canvas layouts and I could have sworn I had confirmed earlier that if you click on an ‘empty’ part of a template canvas that it would just go through and the mouse event would go to the next layer, this does not seem to be the case. Is there something I’m missing here?