Here you can find the source of confirm(String message)
public static boolean confirm(String message)
//package com.java2s; //License from project: Open Source License import java.awt.*; import javax.swing.*; public class Main { public static boolean confirm(String message) { return confirm(null, message); }//from w w w . ja v a 2 s . c om public static boolean confirm(Component parentComponent, String message) { return JOptionPane.showConfirmDialog(parentComponent, message, "Confirm Action", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; } }