Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.File;

import javax.swing.JOptionPane;

public class Main {
    public static boolean confirmOverwrite(Component comp, File file) {
        if (file.exists()) {
            int decision = JOptionPane.showConfirmDialog(comp, file.getName() + " exists. Overwrite?",
                    "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            if (decision == JOptionPane.NO_OPTION) {
                return false;
            }
        }
        return true;
    }
}