private static File getFileFromUser() throws FileNotFoundException {
        // display file dialog, so user can choose file or directory to open
    	File fileName = null;
        
    	JFileChooser fileChooser = new JFileChooser(".");
        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

        int result = fileChooser.showOpenDialog(null);

        // if user clicked Cancel button on dialog, throw exception
        try{
        if (result == JFileChooser.CANCEL_OPTION)
            throw new FileNotFoundException("User selected cancel");
        } catch (FileNotFoundException e) {}
        fileName = fileChooser.getSelectedFile(); // get File

        // display error and throw exception if invalid
        try{
           if ((fileName == null) || (fileName.getName().equals(""))) {
              JOptionPane.showMessageDialog(null, "Invalid Name", "Invalid Name",
                    JOptionPane.ERROR_MESSAGE);
              throw new FileNotFoundException("Invalid Name: " + fileName);
           }
        } catch (FileNotFoundException e) {}
         // end if
        
        
        return fileName;
    } // end method getFileFromUser