Hi there,
This is relatively simple, but first of all, do your long running task in a separate
thread to the swing ui thread otherwise you have a very unresponsive and broken ui.
So, assuming you have a nice worker thread and an algorithm for traversing your disk, a simple one being (in pseudo code)
SearchFile(target directory):
1) from target director
2) for each file in target directory
3) search file
4) for each folder in target directory
5) SearchFile(selected child folder)
This is obviously a depth first recursive search and if you have an extremely deep directory structure you may run out of stack space - but it will do.
What this illustrates though is that you have a handle onto the file that is being searched in step 3). So quite simply, from that step, use what ever notification method you desire to notify some ui component/form that a file is being searched. This could be either having a "filesearched" custom event (better) or a handle onto the component/form and update some text (worse as its tightly coupled).
Remember though that if you update a component from a worker thread (and not the swing ui thread) then you will need to marshal the call across onto the swing ui thread with invokeLater. Do a search on Google for SwingWorkerThread and you'll find out more.
[ April 05, 2005: Message edited by: Jason Kingsley ]