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.

Recommended Answers

All 3 Replies

Just have a method that re-enables the components, and call that as part of whever listener is handling the close of the other window.

I am not sure what to do actually.

nothing clear from posted question

  • your question is about AWT, GWT, JavaFX, Swing etc...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.