title: Add transparent overlay to JavaFX application
body: <p>I'm trying to add an overlay with a transparent background to my JavaFX application, this overlay should not change the way the mouse works or anything, it's just for cosmetic purpose.</p>
  
  <p>I have something like this:</p>
  
  <pre><code>&lt;StackPane&gt;
      &lt;VBox ... /&gt; (The content)
      &lt;Canvas /&gt; (The overlay)
  &lt;/StackPane&gt;
  </code></pre>
  
  <p>But the problem here is that I cannot click on the VBox, because the Canvas is in front of it, so I tried to make the mouse transparent to the Canvas <code>canvas.setMouseTransparent(true)</code>, but when I do this, everything works but all the Mouse Events don't fire anymore, for any of the elements: the canvas, the VBox, the StackPane, the Scene...</p>
  
  <p>I also tried using <code>setPickOnBounds(false)</code> on the canvas, on the StackPane, but it doesn't work either (I can't click on the VBox node).</p>
  
  <p>I feel like this is a JavaFX bug but I'm not sure, I would like to have your opinon.</p>
  
  <p><strong>EDIT</strong><br>
  While doing some furthers testings, I've found the Mouse Moved Event is not called only when hovering an item from the content layer.</p>
  
  <p>Here is an example code to reproduce the issue:</p>
  
  <pre><code>public class TestApp extends Application {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage primaryStage) {
          StackPane root = new StackPane();
  
          root.addEventHandler(MouseEvent.MOUSE_MOVED,
                  event -&gt; System.out.println(event.getX() + " / " + event.getY()));
  
          VBox content = new VBox();
          content.setBackground(new Background(new BackgroundFill(Color.CORNSILK, CornerRadii.EMPTY, Insets.EMPTY)));
          content.setFillWidth(true);
  
          Button test = new Button("This is a test button");
          test.setPrefWidth(500);
          test.setPrefHeight(100);
  
          content.getChildren().add(test);
  
          Canvas overlay = new Canvas();
          overlay.setWidth(1280);
          overlay.setHeight(720);
          overlay.setMouseTransparent(true);
  
          GraphicsContext context = overlay.getGraphicsContext2D();
          context.setFill(Color.color(1, 0.5, 0.5, 0.8));
          context.fillRect(0, 0, 1280, 720);
  
          root.getChildren().addAll(content, overlay);
  
          primaryStage.setScene(new Scene(root, 1280, 720));
          primaryStage.show();
      }
  }
  </code></pre>
  
  <p>With this code, when I hover the button, I can see in the console that the MouseEvent is not called anymore, but when I hover nothing, the MouseEvent is called.</p>