Keeping application busy
1 posts in topic
Flat View  Flat View

Posted By:   vamsi_chintapalli
Posted On:   Wednesday, April 18, 2001 11:12 AM

I am developing an application using swing features.When I click an icon or a button, I need to perform some internal operation during which the application is busy and should not allow the user to perform any operation on GUI. How do I prevent from generating events during that period when the user clicks on some component.

Re: Keeping application busy

Posted By:   Michael_Wax  
Posted On:   Wednesday, April 18, 2001 08:51 PM

Are you sure that you don't want the user to be able to perform any operations while the application is busy? As I user, I find applications which do this very frustrating. In particular, what if the user wants to stop the operation?

To shut off some GUI components during long-duration processing, I have used flags to let the relevant event handlers know when they should not respond, as in the following example:

public void mouseClicked (MouseEvent e) {
if (processStartedFlag) {
//the process that this mouse click would invoke
//is already started - tell the user, then exit
//or give the user a chance to stop the process
else {
processStartedFlag = true;
//now start the process

This flag would only be used by listeners which would affect the ongoing process. Other event handlers, e.g., to change user settings or the view, typically should not be shut down.

About | Sitemap | Contact