What do you mean with "wait"? Do mean "wait" in the sense of blocking the execution until a button is pressed? If so, there are many solutions, but one of the most easiest would be something like this:
while(block) {
Thread.sleep(500);
}
And your dialog sets block = false;
when an OK-button is pressed. There are more sophisticated solutions for that, this is just an example.
If you mean "wait" in the sense of all field must be filled, you could easily implement a listener for every field to enable a OK-button if the last field was edited.
You could have a look at the source code of JDialog
e.g. here. I think the blocking part is done by the method show()
from the super class Dialog
here.
My tip: Don't try to make a multi-page wizard on our own from scratch and don't try to block anything etc. This leads to more problems typically. Instead follow a tutorial like here. It explains how you can use a Dialog as a basis for a wizard.