// Defines what event takes place when button is clicked
public void actionPerformed(ActionEvent e)
//Show an information panel with the options yes/no and message 'choose one':
JOptionPane.showConfirmDialog(null,"Are you sure of that?", "RE-CONFIRM", JOptionPane.YES_NO_OPTION);
From the above codes, how can I capture which button did the user clicked on. If he clicks on Yes then the program will end but when he clicks on No, the program will continue.