Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Window;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;

public class Main {
    /**
     * 
     * @param owner
     * @return El directorio seleccionado
     */
    public static File saveFileChooser(Window owner) {
        int userResponse;
        JFileChooser fileChooser = new JFileChooser();
        FileNameExtensionFilter filter = new FileNameExtensionFilter("XML", "xml");
        fileChooser.setFileFilter(filter);
        userResponse = fileChooser.showSaveDialog(owner);
        if (JFileChooser.APPROVE_OPTION == userResponse) {
            return fileChooser.getSelectedFile();
        }
        return null;
    }
}