Here you can find the source of confirmUserChoiceWithCustomOptions(final Component sourceComponent, final String question, final String defaultOption, final String... options)
public static int confirmUserChoiceWithCustomOptions(final Component sourceComponent, final String question, final String defaultOption, final String... options)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import javax.swing.*; public class Main { public static int confirmUserChoiceWithCustomOptions(final Component sourceComponent, final String question, final String defaultOption, final String... options) { final int selectedOption = JOptionPane.showOptionDialog(sourceComponent, question, "CONFIRM", JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, defaultOption); return selectedOption; }// w ww . j a v a 2s . com }