Hi Guys

I wonder if you can help me with this I have built an application that reads my forum and grades responses and things and adds them to a database,.

When the application is searching my forum the gui is hanging until the search is complete. The front page of my gui is a log of what is being searched and any results are being found but the system is loading the log after the search is complete instead of a real time display,.

Is there any way I can stop the hanging or anyway I could build a status bar or something ?

thanks in advance for you r help.

8 Years
Discussion Span
Last Post by steveh000

See SwingWorker. Your problem is that you are performing your "action" on the Event Thread, rendering it incapable of responding to "user events".


wow thanks I had never even looked at threads before , need to have a good read about them thanks


If i have one thread to handle the gui and events and one to do the search would i put the search thread in a class of its own so it can implement thread ?


The "search" function would be performed in a Thread of its own, of course, but that does not, necessarily, mean that the "search" function need be a class in and of its own. You will need to create a Class extending SwingWorker (if you use that) that does nothing more than execute your "search" function, however you do not, necessarily, need to rewrite whatever classes/methods you already have that actually make up the "search" function. You probably need to study up a bit on threads in general, but for starters, like I said, see the SwingWorker class and tutorial.


thanks for this I have read up and got it now working the right way. I did put the search function in a class of its own but the whole thing runs better so thanks :-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.