Example usage for javax.swing.filechooser FileSystemView getRoots

List of usage examples for javax.swing.filechooser FileSystemView getRoots

Introduction

In this page you can find the example usage for javax.swing.filechooser FileSystemView getRoots.

Prototype

public File[] getRoots() 

Source Link

Document

Returns all root partitions on this system.

Usage

From source file:MainClass.java

public static void main(String[] args) {

    JFileChooser chooser = new JFileChooser();
    FileSystemView view = chooser.getFileSystemView();

    System.out.println("The roots of this filesystem are: ");
    File[] roots = view.getRoots();
    for (int i = 0; i < roots.length; i++) {
        System.out.println("  " + roots[i]);
    }//from   w w  w.  j  ava2  s  . com

}