Solved

Can't lock setCursor in a JComponent

Posted on 2006-06-21
9
355 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now