Java AWT stack overflow

Alibaba cloud Q & A 2022-02-13 07:21:46 阅读数:589

java awt stack overflow

Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError

admin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { RightChooseView.this.dispose(); JDialog d=new JDialog(); new LoginView().show() } });new A new one Dialog,show There are several very simple functions this.setBounds(300, 200, 800, 400);this.setVisible(true);this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

After debugging, he will always be setbounds and setvisible There's an infinite circle between

Take the answer 1:

Hello! , You can try setting the first window to Frame Use constructor Frame It's written in parent.

copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you.