clicking on an image with transparency

Tom Eugelink tbee at tbee.org
Thu Sep 27 19:57:53 PDT 2012


In some of my controls I have some images that are being used as icons. When the user clicks on these icons, a popup should open or close. For these images I use PNGs with have some transparency in them and an onMouseClick event handler won't react on these transparent areas. So now I wrap the ImageView in a Pane and do the on-click on the pane. That works, but seems like a bit of overkill. Group won't do it.

What is the best way to detect a mouse click on any area of an ImageView?

Tom

PS: I would have like to use SVG images, but apparently loading a SVG file is not part of JavaFX?


More information about the openjfx-dev mailing list