This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
*What i want to do?*
I am developing swing based application.
whenever user click start button, it do some work and return the result to main panel. I should enable stop button for user.
Problem 1: whenever i click the button, it will start to run but the main panel is inaccessible. So i am not able to click the stop button.
Problem 2: I replaced the method with thread concept. Main and other thread works concurrently, so i am able to access the main panel now. That's nice.
Bad Thing is: The result statement in the main thread is executed before the other thread finish it's work. So it will display nothing as result.
What i can do? give me some suggestion.
Sorry i misplaced the thread . please move this thread to thread forum
Rob has already told you in your other thread to use SwingWorker. Obviously you must not pause a thread. What is happening is that the thread is busy until your task is completed. You have also probably been told, all Swing components must be accessed from the same thread, called the Event Dispatch Thread.