I have a java applet that has a class and it has a for loop. What I want is for that loop to stop when I hit the "next" button with the mouse clicked event, in a few words how do I stop or continue the cycle catching the mouseevent of that button that is in a different class than the cycle? , how would that condition be? and can you give an example cause my code it doesn´t finish yet and i dont know how can i keep doing it. Thank you very much.
PM(boolean opcNotes[], int numtries){
Sonido sonido=new Sonido[opcNotes[].length];
for(int i=0;i<sonido.length;i++){
sonido[i]=sonido.generateSound[opcNotes];}
for(int i<0;i<sonido.length;i++){
sonido[i].play();
for(int j=0;j<numtries;j++){
if(){continue;} //If i press the "next" button, ill go to the
//next iteration
else if(){ //If i press the "play again" button, ill do the
//action again
numtries++;
sonido[i]().play
}
}