/home/wpollock1/public_html/AJava/FileChooserDemo.java

// Simple demo of using a swing file open dialog.
// Here we try for the native Look-and-Feel (LaF), if possible.
// Written 2/2013 by Wayne Pollock, Tampa Florida USA

import java.io.File;
import javax.swing.*;

public class FileChooserDemo {
    public static void main ( String [] args ) {
        SwingUtilities.invokeLater( new Runnable() {
            public void run () {
                try {
                    UIManager.setLookAndFeel(
                        UIManager.getSystemLookAndFeelClassName() );
                } catch (Exception e) {} // Too bad; use Java's default LaF

                JFileChooser fileChooser = new JFileChooser( "." );
                int status = fileChooser.showOpenDialog( null );
                if ( status == JFileChooser.APPROVE_OPTION ) {
                    File selectedFile = fileChooser.getSelectedFile();
                    System.out.println( "Selected: " + selectedFile.getParent()
                       + " --- " + selectedFile.getName() );
                }
                System.exit( 0 );
            }
        } );
    }
}