int confirmDialog = JOptionPane.showConfirmDialog(null, "You selected quit! \nAre you sure you want to quit?", "Selected Quit", JOptionPane.YES_NO_OPTION);
if(confirmDialog == 0)
System.exit(0);
//focus under this comment here
if(confirmDialog == 1) {
game.reset();
displayBoard();
}
I made a game with a board. I have a quit button to quit the game. When the user clicks the button they are prompted with the JOptionPane above. It is asking them if they are sure they want to quit. I am able to close the game, but my problem is when the user selects "no". I want the user to be able to click "no" and have it so the game resets which it does, I can see the board reseting. But the optionPane does not go away and i want the OptionPane to go away so they can play.