1 Reply Latest reply: Jan 19, 2013 12:35 PM by aidreamer RSS

    How should a custom cursor image be constructed?

    908695
      This relates to Java 1.7_u11 and JFX 2.2.4 on Windows 7 64 bit.

      When I set a Node's cursor to Cursor.CROSSHAIR, the crosshair is displayed with complementary colour to its screen background (e.g. black on white, blue on yellow, etc.) However when I construct my own custom crosshair image, 32 pixels square, with transparent-white background pixels and opaque-black crosshair pixels, and create an ImageCursor from it to use as the cursor, it works fine, but always displays as black, irrespective of the background that it's being displayed over. I've tried various ways of creating the image.

      So my question is, is there something special about the built-in Cursor images, and how should we emulate it for an ImageCursor? More generally, how does the 'blend mode' for cursor images work?

      (Apologies if I'm displaying dismaying ignorance here.)
        • 1. Re: How should a custom cursor image be constructed?
          aidreamer
          Hrm, I tried Crosshair on my Linux computer with different background fills in Scene and didn't notice any change in color. It was always a cross with white fill and black outline. I wonder if the appearance of certain cursors are OS specific.

          Anyways, I don't see anything in the documentation to set that. If you want a more customizable cursor, submit an RFE to http://javafx-jira.kenai.com/