Title says it all, before anyone says that there is a thread about closing a GUI without the program end then hold on a second.
My question is that, how can the PROGRAM close a GUI and not the user so it can progress onto another frame.
Title says it all, before anyone says that there is a thread about closing a GUI without the program end then hold on a second.
My question is that, how can the PROGRAM close a GUI and not the user so it can progress onto another frame.
If this question below is about a Swing GUI:
My question is that, how can the PROGRAM close a GUI and not the user so it can progress onto another frame.
Then this question can be answered thusly:
JFrame.DO_NOTHING_ON_CLOSE
.close()
or setVisible(false)
on the window.i.e.,
myJFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
But having said that, the question in fact should be answered:
Again, note that your question as originally stated is very incomplete, and in the future, you will want to tell us any and all relevant libraries that are involved, here the Swing library since the question is likely essentially a Swing question. You will also want to show some code and explain exactly where you might be stuck. Usually the better the question, the better the answers you'll see. For instance, with more information and code, we could show you some code to get you started with a CardLayout.
java.awt.Window aTopLevelGUI; // Normally referenced as a JWindow, but this is what impls setVisible(boolean)
// To close the window:
aTopLevelGUI.setVisible(false);