I know that there is some questions about this but it seems like I did not understand the concept or there is something wrong with it.
Basically, what I am trying to do is, there is a algorithm which will proceed as;
for(step=0;step<value;step++){
//Do something;
}
But it should be an option so user can see how it perform algorithm each step if he check the isStepped checkbox; So what I came up with is
public void run() {
for (int step = 0; step < f; step++) {
if (isStepped) {
try {
wait();//Here is the problem
} catch (InterruptedException ex) {
Logger.getLogger(MainThread.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
And on the Menuside;
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {
MyThread.notify();
}
So when a nextbuttonclicked, thread should wake up but it seems it wont... What causes this problem, and how can I overcome?