Two Laptop Bag*
The moose likes Java in General and the fly likes show hourglass on each event that lasts longer than two seconds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "show hourglass on each event that lasts longer than two seconds" Watch "show hourglass on each event that lasts longer than two seconds" New topic
Author

show hourglass on each event that lasts longer than two seconds

Rick Morton
Greenhorn

Joined: Jun 26, 2012
Posts: 2
Hi,

I'm looking for a simple way to implement the hourglass when an event needs longer than two seconds to be processed. This should be done through the whole application which would mean a lot of effort to implement it as a listener(s). So i found this article about EventQueues and the automatic hourglass: Java Tip 87: Automate the hourglass cursor

... sound great, i just have to add the EventQueue and the hourglass pops up every time some event needs longer than two seconds. The problem is, it doesn't work. The only thing it does is showing the hourglass for a short period wenn i move the mouse over a component.

Are there any suggestions to solve this problem? Or does i have to implement the listener for each component/area of the application to show the hourglass if the application is processing an event (load items from db, sort, generate files, sync with active directory, ... and so on)?

Thanks
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

An alternative would be to not think about the cursor and maybe consider displaying a status/progress bar or icon that shows that something is still going on in the background. Kind of like how browsers have animated icons that indicate when a page is still loading or how GMail will show a progress bar while its loading up your inbox. Those are things you have more control of than the user's cursor. Same approach as not trying to disable the user's browser Back or Refresh button. Leave the user's things alone, mess with your stuff instead.


Junilu - [How to Ask Questions] [How to Answer Questions]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

I suggest you take a look at ProgressMonitor. It does similar things to what you want, including only showing itself if needed. You can use it and its code (available inside src.zip) as a basis.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: show hourglass on each event that lasts longer than two seconds
 
Similar Threads
Doubt In MVC..
is it possible to capture all events?
how to implement MVC?
Progres monitor bar
Focus Lost throws error