Login  Register

Re: GLWindow Cursor problems

Posted by Demoscene Passivist on Mar 31, 2011; 9:41am
URL: https://forum.jogamp.org/GLWindow-Cursor-problems-tp2756277p2757647.html

Here's the snippet that works for me, maybe u should give it a try:

    public static Cursor createHiddenCursor() {
        Toolkit tToolkit = Toolkit.getDefaultToolkit();
        Dimension tDimension = tToolkit.getBestCursorSize(1, 1);
        BufferedImage tCursorImage = new BufferedImage(tDimension.width, tDimension.height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D tGraphics2D = tCursorImage.createGraphics();
        tGraphics2D.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f));
        tGraphics2D.clearRect(0, 0, tDimension.width, tDimension.height);
        tGraphics2D.dispose();
        Cursor tHiddenCursor = tToolkit.createCustomCursor(tCursorImage, new Point(0,0), "HiddenCursor");
        return tHiddenCursor;
    }