get Boolean Dialog - Java Swing

Java examples for Swing:JOptionPane

Description

get Boolean Dialog

Demo Code


//package com.java2s;
import java.awt.Component;
import javax.swing.JOptionPane;

public class Main {
    public static int getBooleanDialog(Component father, String title) {
        int option = JOptionPane.showConfirmDialog(father, title);
        if (option == JOptionPane.YES_OPTION) {
            return 1;
        } else if (option == JOptionPane.NO_OPTION) {
            return 0;
        } else {//from   w w w .jav  a 2s  . c om
            return 2;
        }
    }
}

Related Tutorials