// sample use of showConfirmDialog import javax.swing.JOptionPane; ... int answer = JOptionPane.showConfirmDialog ( this, "Do you really want to shutdown everything?" ); if ( answer == JOptionPane.YES_OPTION ) { shutdown(); }