Reputation: 163
I've got a group which is composed of rectangle nodes. They are scattered around the group and a lot of the groups background is visible and unfilled by rectangles.
I have a context menu popup when the rectangle is clicked, and I would like a different context menu to show when the group background is clicked.
I tried
Group g = new Group();
g.setOnMouseClicked((e) -> {
world.show(g, Side.TOP, 0, 0);
});
But now when I click on a rectangle both the rectangles context menu shows up as well as the groups context menu.
How could I make it so the group menu shows up only when clicking on the background (where a rectangle is not placed)?
Upvotes: 1
Views: 382
Reputation: 49195
Try to consume the event received to rectangles
rect.setOnMouseClicked( e -> {
world.show(rect, Side.TOP, 0, 0);
e.consume();
});
Upvotes: 1