Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.FileDialog;

import java.awt.Frame;

public class Main {
    /**
     * Select the file path via {@linkplain FileDialog}.
     * 
     * @param parent
     *            the parent of {@linkplain FileDialog}
     * @param title
     *            the title of {@linkplain FileDialog}
     * @return the selected path
     */
    public static String selectPath(Frame parent, String title) {
        FileDialog dialog = new FileDialog(parent, title, FileDialog.LOAD);
        dialog.setVisible(true);
        String dir = dialog.getDirectory();
        dialog.dispose();
        return dir;
    }
}