This discussion is archived
2 Replies Latest reply: Oct 12, 2011 1:47 AM by gimbal2 RSS

paust thread for until finish work.  Stop button.

829396 Newbie
Currently Being Moderated
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.

The Problem:
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.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points