so I have a program that first displays a login screen (login_menu()), once the user successfully logs in, then i want to open another screen that allows the user to open an account. My problem now is that both login_menu and my frame are opening at the same time. Is there any way for the second frame to wait for the first one to close?
void open_account() throws FileNotFoundException, IOException {
Account account = new Account();
        Sav_Acct sav_acct = new Sav_Acct();
        Customer customer = new Customer(); // create new customer object
        final JFrame frame = new JFrame("Open Account");
        frame.setSize(500,200);
        JPanel controlPanel = new JPanel();
         login_menu();
         JLabel title = new JLabel("Checkings or Savings?", JLabel.CENTER);
         JButton checkingsbtn = new JButton("Checkings");
         JButton savingsbtn = new JButton("Savings");
         checkingsbtn.setBounds(0, 0, 200, 75);
         savingsbtn.setBounds(250, 0, 200, 75);
         controlPanel.add(title);
         controlPanel.add(checkingsbtn);
         controlPanel.add(savingsbtn);
         frame.add(controlPanel);
         frame.setVisible(true);