Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding Cursor



Jonathan Hecht <email@hidden> wrote:

>I am trying to hide a cursor in a game that uses the mouse to control a
>paddle. I am using swing with a JFrame containing the game and the actual
>game repainting a JPanel. I have examined the Cursor class and the
>methods in JFrame and did not find an option to hide the Cursor. Ideally
>I would like to hide the Cursor when mousing over the JPanel.

Just create a custom Cursor that has no pixels in it, or only transparent
pixels. See:
Toolkit.createCustomCursor()

This method is only available on Java 2, so it won't work if your game
needs to run on Classic or earlier.

The doc-comment for the method says:
* If the image to display is invalid, the cursor will be hidden (made
* completely transparent), and the hotspot will be set to (0, 0).

Unfortunately, it doesn't elaborate on what "invalid" means.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.