import java.io.File;
import javax.swing.JFileChooser;


public class DirChooser
{
    private static final JFileChooser ourChooser = new JFileChooser(
        System.getProperties().getProperty("user.dir"));


    public DirChooser ()
    {
        ourChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }


    public File getDirectory ()
    {
        if (ourChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
        {
            return ourChooser.getSelectedFile();
        }
        else
        {
            return null;
        }
    }
}
