sargent240
asked on
Turn off cursor
I have a java applications and I need to be able to disable and enable the cursor. Any suggestions?
ASKER
Boy, I did not handle this question very well. Really I would like to be able to disable and enable the mouse. I have an applications using a touch screen and I am using a mouse motion event to detect a touch on a box on the touch screen. When the user touches the button I increment or decrement a number. It works great except if the operator moves the mouse across the button the number goes up by a bunch rather that one. My though is if I disable the mouse I would not have the problem and then enable it again when the operator leaves the program.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. I have resigned myself to using the mouse and not the touch screen in this application or I would have been putting the heat on ya. Thank you for the info
Cheers
Cheers
If so, you can create a "blank" cursor (as Java/Swing doesn't provide one by default) with the following line of code...
Open in new window
Then whenever you want to hide the cursor, you can do this...Open in new window
And to show it again, you can do this...Open in new window
Assuming the "jframe" is a reference to your main JFrame that your application runs in. If you only want to hide the cursor in a specific part of your UI, you can just set the blankCursor on that specific UI element.Oh, and by the way, you might have guessed from the above that since the cursor is only "hidden" then you can theoretically still click on UI items, or drag, etc. you just can't see exactly where it is!