Solved

Can't lock setCursor in a JComponent

Posted on 2006-06-21
9
353 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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:mayankeagle
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:mayankeagle
ID: 16957823
In that case - yes.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
nestparen challenge 4 56
Error with Java/Cache JDBC Classpath 2 20
recursion example 16 69
backtracking recursion  code 19 40
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

758 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

20 Experts available now in Live!

Get 1:1 Help Now