Java JFileChooser .showOpenDialog (Component parent)
Syntax
JFileChooser.showOpenDialog(Component parent) has the following syntax.
public int showOpenDialog(Component parent) throws HeadlessException
Example
In the following code shows how to use JFileChooser.showOpenDialog(Component parent) method.
import javax.swing.JFileChooser;
/* w ww.j av a2 s .c om*/
public class Main {
public static void main(String[] a) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fileChooser.showOpenDialog(null);
}
}
Home »
Java Tutorial »
javax.swing »
Java Tutorial »
javax.swing »