Example usage for javax.swing JFileChooser setFileSystemView

List of usage examples for javax.swing JFileChooser setFileSystemView

Introduction

In this page you can find the example usage for javax.swing JFileChooser setFileSystemView.

Prototype

@BeanProperty(expert = true, description = "Sets the FileSytemView used to get filesystem information.")
public void setFileSystemView(FileSystemView fsv) 

Source Link

Document

Sets the file system view that the JFileChooser uses for accessing and creating file system resources, such as finding the floppy drive and getting a list of root drives.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JFileChooser chooser = new JFileChooser();
    File f = new File(new File("filename.txt").getCanonicalPath());

    chooser.setFileSystemView(FileSystemView.getFileSystemView());
    chooser.showDialog(new JFrame(""), null);
    File curFile = chooser.getSelectedFile();
}