title: Custom cursor set in Javafx
body: <p>I am aware that you can define the cursor through CSS like described in <a href="https://stackoverflow.com/questions/38168501/javafx-custom-css-cursor">JavaFX custom css cursor</a> or even set it globally like this:</p>
  
  <pre><code>private void setCursor(Scene scene) {
      Dimension2D dim = ImageCursor.getBestSize(64, 64);
      URL url;
      if (dim.getWidth() &gt; 32) {
          url = getClass().getResource("/icons/64/cursor.png");
      } else {
          url = getClass().getResource("/icons/32/cursor.png");
      }
      try {
          Image img = new Image(url.openStream());
          scene.setCursor(new ImageCursor(img));
      } catch (IOException e) {
          logger.warn("Failed to load cursor icon from {}", url);
      }
  }
  </code></pre>
  
  <p>This however only set's the default cursor globally, while other types of cursor (e.g. caret, processing) remain untouched. Is there a way to supply the JavaFX application with a cursor set that covers all the cases?</p>
  
  <p>Furthermore with the above solution the cursor is tied to the scene, which means, that once it leaves the scene and e.g. hovers over the menu bar, it reverts to the default as set in the OS. Is there a way to define the cursor on the level of the stage or application instead of the scene?</p>
  
  <p>An acceptable answer would also be: cannot be done. Then I do not need to look further.</p>