Simplified problem:
Make one Node "A" which on top of the other Node "B" will be half transparent for MouseEvents, so the events will reach the base Node "B". Both nodes are the same size, but Node "A" has a translucent background image, so half of Node "B" is visible.
The real problem:
I have a tab menu. Each tab can be dragged to expand the corresponding menu layer. Therefore, each tab layer is a panel with a partially transparent background (mainly a polygon), the transparent part of which must also be transparent for MouseEvents.
The illustration (which I still can’t publish, see the link: Tabs illustration , the dark green line is the border of the green Panel) shows the basic principle: just imagine that only the tabs are visible, and the layer itself can be pulled to the right to view its contents.
So the question is how to make the Node region transparent to MouseEvents without the transparency of the entire Node?
Thank you for your help!
Update:
To clarify a simple problem, here is the corresponding code:
Group root = new Group();
Stop[] stops = new Stop[] { new Stop(0, Color.rgb(0, 255, 0, 0.0)), new Stop(1, Color.rgb(0, 255, 0, 1.0))};
LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
Rectangle A = new Rectangle(100, 50, lg1);
Rectangle B = new Rectangle(100,50, Color.RED);
A.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
System.out.println("Clicked A");
}
});
B.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
System.out.println("Clicked B");
}
});
root.getChildren().addAll(B, A);
Hope this helps.