PK your code does not compile
Boolean midipedalflag;
midipedalflag=false; // the flag set by midipedal
do { // and space bar
synchronized(midipedalflag){
midipedalflag.wait();
}
} while (!midipedalflag);
midipedalflag=false;
After all the loop of mine is not a very elegant way of doing things, I admit, but at least I ensure that, while spinning in that loop, there is not happening to much more. When the flag is set (or the box unchecked) the thread terminates and the info screen displays ¨pedal pushed¨ .... not much more should happen for the moment. Because that is all, waiting and notifying, is not really needed!? I tested the thing and saw no problem, Sure when more things are involved one should look for other ways!