Samples‎ > ‎WinPack Samples‎ > ‎

Select Folder Dialog Sample

import com.jniwrapper.win32.ui.dialogs.SelectFolderDialog;

/**
 * This sample demonstrates how to work with {@link SelectFolderDialog}.
 */
public class SelectFolderDialogSample
{
    public static void main(String[] args)
    {
        SelectFolderDialog dialog = new SelectFolderDialog("Select folder");
        dialog.setFolder("C:\\");
        dialog.getOptions().setShowNetworkFolders(true);
        final boolean result = dialog.execute();
        System.out.println("result = " + result);
        if (result)
        {
            final String directory = dialog.getFolder();
            System.out.println("Selected folder = " + directory);
        }
    }
}