/*
 * JIDialog.java
 *
 * Created on 22 Αύγουστος 2005, 3:28 πμ
 *
 * This file is part of Jubler.
 *
 * Jubler is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 2.
 *
 *
 * Jubler is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jubler; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

package com.panayotis.jubler;

import java.awt.Component;
import javax.swing.JOptionPane;

import static com.panayotis.jubler.i18n.I18N._;


/**
 *
 * @author teras
 */
public class JIDialog extends JOptionPane {
    public static final Object[] ok_opts = {_("OK")};
    public static final Object[] ok_cancel_opts = {_("OK"), _("Cancel")};
    public static final Object[] yes_no_opts = {_("Yes"), _("No")};
    
    public static void message(Component parent, Object message, String title, int type) {
        showOptionDialog(parent, message, title, DEFAULT_OPTION, type, null, ok_opts, ok_opts[0]);
    }
    
    public static int question (Component parent, Object message, String title) {
        return question(parent, message, title, false);
    }

    public static int question(Component parent, Object message, String title, boolean is_yes_no) {
        return question(parent, message, title, QUESTION_MESSAGE, is_yes_no);
    }
    
    public static int question (Component parent, Object message, String title, int type, boolean is_yes_no ) {
        if (is_yes_no) {
            return showOptionDialog(parent, message, title, DEFAULT_OPTION, type, null, yes_no_opts, yes_no_opts[0]);
        }
        else {
            return showOptionDialog(parent, message, title, DEFAULT_OPTION, type, null, ok_cancel_opts, ok_cancel_opts[0]);
            
        }
    }

}
