I am working on a Java GUI program right now. (Using Eclipse+Windowbuilder)

I have the following situation:

The subprogram B calls a Dialog Window to ask the user for input and terminates with calling program A.
But I do not want program A to be called yet. It should be called after the Dialog Window terminated.

```
B:
dialogWindow();
<------- here B should wait for dialogWindow to finish
A();
exit();

```

Is there a **way to wait** for dialogWindow()? (I do not want to move the A(); command)

Thanks in advance.

EDIT:
The dialogWindow is actually just a normal JFrame.