title: JavaFX: On Mouse Clicked event for parent and its children
body: <p>I have a card, that consists of header, body and footer, that can consist of more nodes, like labels, text fields etc. </p>
  
  <p>And I need to catch <code>on mouse clicked</code> event ANY TIME when the click occurred <strong>inside the card</strong>, no matter if it was the card itself or one of its children. For now if I click text field, event is not triggered.</p>
  
  <pre><code>private StackPane newCard() {
          //card wrapper
          StackPane card = new StackPane();
          VBox cardContent = new VBox();
  
          JFXDepthManager.setDepth(card, 1);
          //Header
          StackPane header = new StackPane();
  
          VBox headerContent = new VBox();
          header.getChildren().add(headerContent);
          Label label = new Label("Card title");
  
          //if I click this text field, event is not triggered
          TextField groupCode = new TextField();
  
          headerContent.getChildren().addAll(label, groupCode);
  
          //body
          StackPane body = new StackPane();
  
  
          //footer
          StackPane footer = new StackPane();
  
  
          cardContent.getChildren().addAll(header, body, footer);
          card.getChildren().add(cardContent);
  
          //event
          card.setOnMouseClicked(event -&gt; System.out.println("Clicked!"));
  
          return card;
      }
  </code></pre>
  
  <p>So like in example above, if I click the text field to type something, <code>"Clicked!"</code> is not printed. </p>