Set hour glass

I have a menu item by using process in java I call another class . I want to ask how can I change the mouse pointer to hour glass until the process is not completed.
mattjuliusAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSr. Software engineerCommented:
zzynxSr. Software engineerCommented:
In your case: use Cursor.WAIT_CURSOR
Mick BarryJava DeveloperCommented:
call the setCursor(Cursor.WAIT_CURSOR) method for the component you want the hourglass to appear over (ie. when the cursor is over that component.
If you want it for the whole frame then set it for the frames content pane
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

mattjuliusAuthor Commented:
to zzynx:

I already have that but how can I do it while in process.
Mick BarryJava DeveloperCommented:
You need to call on the event disspatch thread

so call it before you start your processing thread, or call it using EventQueue.invokeLater()

zzynxSr. Software engineerCommented:
>> how can I do it while in process
yourComp.setCursor(Cursor.WAIT_CURSOR);

// do your call that doens't return until done

yourComp.setCursor(Cursor.DEFAULT_CURSOR);
Mick BarryJava DeveloperCommented:
component.setCursor(Cursor.WAIT_CURSOR);

// start your processing thread now



And in your processing thread you set it back:


public void run() {

    // do your processing here

    EventQueue.invokeLater(new Runnable() {
       public void run() {
          component.setCursor(original);
       }
    });
}

zzynxSr. Software engineerCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zzynxSr. Software engineerCommented:
Thanx 4 axxepting
What answer did you expect to award it with an A grade?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.