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.JFileChooser;

public class Main {

    public static File chooseDirectory(Component parentComponent, String title) {
        JFileChooser jfc = new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        jfc.showDialog(parentComponent, title);
        return jfc.getSelectedFile();
    }
}