Is there a way to hide cursor (other than using transparent image as a cursor)?
I want to hide the cursor, when the user point the mouse outside JPanel in JFrame.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It appears that the
Cursorclass does not have a “blank” cursor to begin with, so one could define a new “blank” cursor using theToolkit.createCustomCursormethod.Here’s one way I’ve tried which seems to work:
Edit
Regarding the comment about everything inside the
JFrameending up without a cursor, it seems that theComponents which are contained in theJFramewill end up inheriting the cursor of the container (theJFrame), so if it is a requirement to have a certainComponenthave the cursor appear, one would have to manually set the desired cursor.For example, if there is a
JPanelcontained in theJFrame, then one could set the cursor of thatJPanelto the system’s default using theCursor.getDefaultCursormethod: