Solved

Can't lock setCursor in a JComponent

Posted on 2006-06-21
9
358 Views
Last Modified: 2013-11-23
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
Comment
Question by:rubentrancoso
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 16957411
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
 

Author Comment

by:rubentrancoso
ID: 16957425
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
 

Author Comment

by:rubentrancoso
ID: 16957436
Maybe there's a way yo change the cursor in toolkit in a global way
0
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.

 

Author Comment

by:rubentrancoso
ID: 16957440
"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
 
LVL 92

Expert Comment

by:objects
ID: 16957442
sounds like what you want is to change the cursor for the entire container, instead of the individual component.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 16957444
Yes, the cursor in JAVA has some weird weaknesses; it's also impossible to provide your own busy cursor.

;JOOP!
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16957470
Cursor.getPredefinedCursor ( Cursor.WAIT_CURSOR ) ; ?
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 16957501
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 16957823
In that case - yes.
0

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 82
varialbe initialization 11 37
Cisco ASA: Java web start no go, asdm launcher no go 3 34
Eclipse for Java EE development 2 27
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question