Can't lock setCursor in a JComponent

I had implemented a mouse listener to change cursor according the task in a jcomponent, but whe cursor reach another instance of a this jcomponent, the cursor change again. I need that the cursor stay locked to the component where mouse was pressed until I release it. How can I avoid this undesired change?
rubentrancosoAsked:
Who is Participating?
 
objectsCommented:
you cannot stop the cursor leaving the bounds of a component afaik
and if you want the cursor to stay the same when in other components tyou need to set the cursor for all components you want it to take effect in.
0
 
rubentrancosoAuthor Commented:
unbelivable! :/
you mean that every time I press the mouse button in a component to move it in a JPanel i.e. I want to notify all widgets in my application to not change it until released???
it's almos impossible to maintain.
0
 
rubentrancosoAuthor Commented:
Maybe there's a way yo change the cursor in toolkit in a global way
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
rubentrancosoAuthor Commented:
"A change in the cursor occurs only when it is over the component that has set it. If you want to set the cursor for the whole window (JFrame), you need to set it for the content pane of the window."
0
 
objectsCommented:
sounds like what you want is to change the cursor for the entire container, instead of the individual component.
0
 
sciuriwareCommented:
Yes, the cursor in JAVA has some weird weaknesses; it's also impossible to provide your own busy cursor.

;JOOP!
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Cursor.getPredefinedCursor ( Cursor.WAIT_CURSOR ) ; ?
0
 
sciuriwareCommented:
mayankeagle, just take an animated gif; put it in a JLabel and it lives,
try to use it as a cursor ... and it's dead.

;JOOP!
0
 
Mayank SAssociate Director - Product EngineeringCommented:
In that case - yes.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.