I created an ImageView with an image with transparent portions. I also did some scaling and moving, which I though might cause this effect, but that is not the case. When I click on the transparent portion of the image the onMouseClick event is not fired. Other mouse events (mouse enter, mouse move, mouse exit, ...) get fired. Only when I click on the non transparent part the click event is fired.
Image img = new Image(getClass().getResourceAsStream("barrel_icon.png"));
ImageView view = new ImageView(img);
view.setScaleX(0.5);
view.setScaleY(0.5);
view.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println("Clicked on the scaled icon");
}
});
StackPane root = new StackPane();
Group group = new Group(view);
group.setManaged(false);
group.setLayoutY(-13);
group.setLayoutX(-13);
root.getChildren().add(group);

The area between the barrel and the shadow belongs clearly to the image, however is transparent.
I am wondering if there is a reason for this behaviour and what is the best way to work around this issue, as my image has large transparent portions and the non transparent parts are hard to click on.
By the way this is all based on JavaFX 2.2.
Regards
Hotzst