How to wait until another form closes?

I am writing a program that will open another form, the user will continue doing stuff on the new form and would then close the form. When and only when this new form closes, the main form should continue with its work and re-enable some components. Here is the code:

// If the user account exists then load the transaction form
if(userAccountExists == true) {
// Create a new instance of the ATMTransactionOptions form
ATMAccountData atmAccountData = accounts.get(0);
ATMTransactionOptions ato = new ATMTransactionOptions();
// Pass the account data to the new form
ato.setATMAccountData(atmAccountData);
// Clear the current account data in the atmAccountData
atmAccountData.clearAll();
// Clear the current form data
edtAccountNumber.setText("");
pwdPassword.setText("");
// Disable the form input methods
edtAccountNumber.setEnabled(false);
pwdPassword.setEnabled(false);
btnLogin.setEnabled(false);
// Display the form
ato.setVisible(true);
// The program should wait here until the ATMTransactionOptions (ato) form is closed
// only then should it continue to the following lines
/*edtAccountNumber.setEnabled(true);
pwdPassword.setEnabled(true);
btnLogin.setEnabled(true);*/
}

Currently its commented out, else the program re-enables the components.

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...