出于某种原因,我的 JFrame 没有关闭按钮?我尝试更改代码,但似乎不起作用。
public NewJFrame()
{
this.setUndecorated(true);
this.setVisible(true);
initComponents();
this.setDefaultCloseOperation(NewJFrame.EXIT_ON_CLOSE);
Toolkit tk = Toolkit.getDefaultToolkit();
int x = (int) tk.getScreenSize().getWidth();
int y = (int) tk.getScreenSize().getHeight();
this.setSize(x,y);
}
最佳答案
关闭按钮是您删除的装饰之一
this.setUndecorated(true);
如果您想要恢复它,您必须删除此行或创建您自己的一行。
关于java - JFrame没有关闭窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45576703/