Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
我创建了一个JDialog然后一个按钮加了个监听器
admin.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
RightChooseView.this.dispose();
JDialog d=new JDialog();
new LoginView().show();
// MyFrame frame=new MyFrame("测试");
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setSize(400,300);
// frame.setVisible(true);
}
}
);
new了一个新的Dialog,show里面就是很简单的几个函数
this.setBounds(300, 200, 800, 400);
this.setVisible(true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
调试了一下他会一直在setbounds和setvisible之间无限循环...
后来实在不知道怎么办就把第一个窗口设置成Frame用构造函数把Frame写成parent就不报错了...