所以我有一个程序首先显示登录屏幕(login_menu()),一旦用户成功登录,然后我想打开另一个允许用户打开帐户的屏幕。我现在的问题是login_menu和我的框架同时打开。有没有办法让第二帧等待第一帧关闭?
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);