Hiding mouse by setting transparent image not working

Started by GinjaNinja32, July 27, 2013, 15:34:59

Previous topic - Next topic

GinjaNinja32

Setting the mouse cursor to a 1x1 image filled with A00R00B00G00 displays a black dot at the location of the cursor. I have called Cursor.getCapabilities() to see whether transparency is supported (not that I expected it not to be on a modern card), it returns 1 (one bit transparency, 0x00 or 0xff only).
This sometimes works through NetBeans (in certain projects), but never works running the compiled jar.
Code I'm using to set the cursor:
either
Mouse.setNativeCursor(new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null));

or
Mouse.setNativeCursor(new Cursor(1, 1, 0, 0, 1, (IntBuffer)IntBuffer.allocate(1).put(0x00000000).rewind(), null));

The first one doesn't work anywhere, the second is the one that sometimes works through NetBeans.
short example code, neither method works either through NetBeans or the jar: http://pastebin.com/tabSwR9Q

I can post the full code (the one that works through NetBeans), but that uses a custom API and a few Lua files, so it's a bit more complicated.

TechNick6425

You can hide the mouse by using
Mouse.setGrabbed(true);

GinjaNinja32

Mouse.setGrabbed(true)

also forces the mouse to stay inside the window, which I don't want to do. I want to make the cursor invisible when it's over the window, but allow it to leave the window.

This post is what I want to do, but the method given there leaves a black dot where the mouse is instead of the mouse being invisible.