Class FileChooser

java.lang.Object
  extended by FileChooser

public class FileChooser
extends Object

A class to make working with a file chooser easier for students. It uses a JFileChooser to let the user pick a file and returns the choosen file name. Copyright Georgia Institute of Technology 2004

Author:
Barb Ericson ericson@cc.gatech.edu

Constructor Summary
FileChooser()
           
 
Method Summary
static String getMediaDirectory()
          Method to get the directory for the media
static String getMediaPath(String fileName)
          Method to get the full path for the passed file name
static String pickADirectory()
          Method to let the user pick a directory and return the full path name as a string.
static String pickAFile()
          Method to let the user pick a file and return the full file name as a string.
static void pickMediaPath()
          Method to pick a media path using the file chooser and set it
static String pickPath(JFileChooser fileChooser)
          Method to pick an item using the file chooser
static void setMediaPath(String directory)
          Method to set the media path by setting the directory to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChooser

public FileChooser()
Method Detail

pickPath

public static String pickPath(JFileChooser fileChooser)
Method to pick an item using the file chooser

Parameters:
fileChooser - the file Chooser to use
Returns:
the path name

pickAFile

public static String pickAFile()
Method to let the user pick a file and return the full file name as a string. If the user didn't pick a file then the file name will be null.

Returns:
the full file name of the picked file or null

pickADirectory

public static String pickADirectory()
Method to let the user pick a directory and return the full path name as a string.

Returns:
the full directory path

getMediaPath

public static String getMediaPath(String fileName)
Method to get the full path for the passed file name

Parameters:
fileName - the name of a file
Returns:
the full path for the file

getMediaDirectory

public static String getMediaDirectory()
Method to get the directory for the media

Returns:
the media directory

setMediaPath

public static void setMediaPath(String directory)
Method to set the media path by setting the directory to use

Parameters:
directory - the directory to use for the media path

pickMediaPath

public static void pickMediaPath()
Method to pick a media path using the file chooser and set it