JoptionPane ShowConfirmDialog
问题 I have a Java program. When I run the program, it will give me a GUI which as I attached. When I want to close it, it will prompt out a confirm dialog. If I press the Yes button, it will quit the program using System.exit() . public static void main(String args[]) { ButtonTest app = new ButtonTest( ); app.addWindowListener( new WindowAdapter( ) { public void windowClosing (WindowEvent e) { String message = " Really Quit ? "; String title = "Quit"; int reply = JOptionPane.showConfirmDialog