Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.Component; import javax.swing.JOptionPane; public class Main { public static boolean confirmationPrompt(String msg, String title, Component parent) { Object[] options = { "Yes", "No" }; int n = JOptionPane.showOptionDialog(parent, msg, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if (n == 0) { return true; } else { return false; } } }