I have a jframe with "search button", when the user clicks it, a function will be called to search through several databases for the specified search criterion. What I want is to have a "wait/loading message" to appear while the function is searching, and disappears once the function is done executing. I searched for similar ideas and all of them are using thread programming. Can someone insight me if it is possible to use threads on my situation and if there are any other options? thank you
You should perform the search in a background thread, and notify the UI using for example invokeLater.
You can find more informations and an example here http://www.javamex.com/tutorials/threads/invokelater.shtml
You could do the search process on the UI thread, but since it apearantly takes long to complete, the GUI would freeze. So for a fluid using expirience i would reccomend doing the search in another thread. Mulit-Thread programming is not as difficult as you might think. See this tutorial
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.