Link to home
Start Free TrialLog in
Avatar of rubentrancoso
rubentrancoso

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rubentrancoso
rubentrancoso

ASKER

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.
Maybe there's a way yo change the cursor in toolkit in a global way
"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."
sounds like what you want is to change the cursor for the entire container, instead of the individual component.
Yes, the cursor in JAVA has some weird weaknesses; it's also impossible to provide your own busy cursor.

;JOOP!
Cursor.getPredefinedCursor ( Cursor.WAIT_CURSOR ) ; ?
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!
In that case - yes.