Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Component;

import javax.swing.JOptionPane;

import javax.swing.UIManager;

public class Main {
    /**
     * Shows a confirm dialog.
     * 
     * @param c
     *            the parent component.
     * @param msg
     *            the message to display.
     * @return an int indicating the option selected by the user.
     */
    public static int showConfirmDialog(Component c, String msg) {
        return showConfirmDialog(c, msg, JOptionPane.QUESTION_MESSAGE);
    }

    /**
     * Shows a confirm dialog.
     * 
     * @param c
     *            the parent component.
     * @param msg
     *            the message to display.
     * @param messageType
     *            the type of message to display.
     * @return an int indicating the option selected by the user.
     */
    public static int showConfirmDialog(Component c, String msg, int messageType) {
        return JOptionPane.showConfirmDialog(JOptionPane.getFrameForComponent(c), msg,
                UIManager.getString("OptionPane.confirmDialogTitle"), JOptionPane.YES_NO_OPTION, messageType);
    }
}