0
我需要關閉我的應用程序當前窗口,而不關閉整個應用程序我的代碼如下,以設置窗口可見,但它關閉所有窗口,當我點擊時,當前打開的任何窗口右上角的紅色十字按鍵關閉jframes當前窗口,而不是整個應用程序
private void lb_helpMouseClicked(java.awt.event.MouseEvent evt) {
new Reports().setVisible(true);
}
private void lb_certMouseClicked(java.awt.event.MouseEvent evt) {
new ChooseCert().setVisible(true);
}
private void lb_reportMouseClicked(java.awt.event.MouseEvent evt) {
new Reports().setVisible(true);
}
Try frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); –
聽起來像EXIT_ON_CLOSE是問題,而不是解決方案。將任何將默認關閉操作設置爲EXIT_ON_CLOSE的行更改爲使用DISPOSE_ON_CLOSE。 – VGR