Hi, my program is closing if the user presses "yes" or "no" when asked if they want to quit after pressing the "x" on the top right corner of the program. I am wondering how I can keep the program running if they press "no". Thanks.
Here is the code:
Here is the code:
Code:
public void closeProgram()
{
int answer = 0;
answer = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit?", "ExitProgram?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (answer == JOptionPane.YES_OPTION)
{
dbAccess.close();
db.CloseDB();
System.exit(0);
}
}