I would like to modify the code below to present a yes or no option when the user presses X, but I am afraid that my java newbie skills are not yet drawn to it. Any suggestions please? I would like to leave the code below as complete as possible to see what needs to be done differently for future reference.
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class WindowExit extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
JOptionPane.showMessageDialog( null, "Are you sure you want to close?" );
System.exit(0);
}
}
source
share