Monday, 9 September 2013

How to resume a thread

How to resume a thread

I'm using three threads in my code.When i press 'stop' button it should
stop and 'start' button should resume them..here is my code :
private void jButton_stopActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
boolean result = value;
if(result){
t.stop();
timer.stop();
timer2.stop();
value = false;
jButton_stop.setText("Start");
}
else{
t.resume();
timer.resume();
timer2.resume();
value = true;
jButton_stop.setText("Stop");
}
But when i click the 'stop' button all the threads are stopped
perfectly,but when i press 'start' button threads are not resuming .why??
please help me.

No comments:

Post a Comment