@Override protected void processWindowEvent(WindowEvent e){ if (e.getID() == WindowEvent.WINDOW_CLOSING) { int exit = JOptionPane.showConfirmDialog(this, "Are you sure? Your Game Will Not be Saved!"); if ((exit == JOptionPane.YES_OPTION)) { Game_titleMenue s = new Game_titleMenue(); s.setVisible(true); close(); } } else { super.processWindowEvent(e); } } private void close() { WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent); } }
trying to close the jframe that is open and open another jframe to go back to the program selection.
but reopens the jframe that was open ect. try running the coed with 2 jframes and you will see my problem.