如何一次显示一个Jframe?

时间:2015-11-04 02:55:07

标签: java swing jframe

所以我有一个程序首先显示登录屏幕(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); 

0 个答案:

没有答案