I am working on a project, where I have a GUI(BorderPane) and a movableMap(Pane) in a StackPane, but when I want to click on the map or one of his child the event handler handels only on the GUI. How can I fix this problem?
I put all my objects in a Map pane, and i move this Pane in an another Pane.
And here is some code:
Pane Map = new Pane();
Map.getChildren().addAll(...);
Map.setLayoutX(0);
Map.setLayoutY(0);
Map.setOnMouseClicked(e-> System.out.println("Click1"));
GUI = new BorderPane();
GUI.getChildren().addAll(...);
GUI.setOnMouseClicked(e -> System.out.println("Click2"));
MovableMap = new Pane();
MovableMap.getChildren().add(Map);
MovableMap.setOnMouseClicked(e -> System.out.println("Click3"));
StackPane root = new StackPane();
root.getChildren().addAll(MovableMap,GUI);
root.setOnMouseClicked(e -> System.out.println("Click4"));