Updating progress bar when retrieving records from database
Here are two common ways to call this method: The Swing framework manages component drawing, updates, and event handlers on the EDT.As you might imagine, the event queue for this thread is busy because every GUI interaction and event passes through it.All event handlers run on the EDT, and you should programmatically interact with your UI components and their basic data models only on the EDT.Any tasks running on the EDT should finish quickly so that your UI is responsive to user input.Finding problematic code may not always be simple, but the Java Platform, Standard Edition 6 (Java SE 6) makes it easier to fix such code by providing the application programming interface (API) by interacting with the popular Flickr web site to search and download images.
The Image Search demo performs a long-running task that should not execute on the EDT -- accessing a Flickr web service.Ideally, any task that requires more than 30 to 100 milliseconds should not run on the EDT.Otherwise, users will sense a pause between their input and the UI response.Accessing your UI components or their event handlers from other threads will cause update and drawing errors in the UI.Performing long-running tasks on the EDT will cause your application to become unresponsive because GUI events will accumulate in the event dispatch queue.
Search for updating progress bar when retrieving records from database:
The result is that applications become unresponsive or sluggish because they perform long-running tasks on the EDT instead of on separate worker threads.