Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

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?
0
rubentrancoso
Asked:
rubentrancoso
  • 3
  • 2
  • 2
  • +1
1 Solution
 
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now