A student came into my office to ask this. Good question.
If you put in a panel.sleep(<millis>) then that will wait for a little while, but then continue after that time. What we want to do is *repeatedly* sleep for a little bit, and then check whether the mouse is clicked, and then sleep for a bit, and then check whether the mouse is clicked... and as long as the mouse has NOT been clicked, we should keep doing this.
Once the mouse is clicked, then the loop should finish and the rest of your program should continue running.
You'll want to use a WHILE loop for this, along with the panel.checkMouseClicked() method which returns a boolean value.
Hope that helps!