This method of the UserFileDialog Class retrieves the name of the last file opened with a dialog box if a successful file open operation has been performed with the dialog box. This method returns null if the dialog box has never been used to open a file or if the last attempt to open a file with the dialog box failed for any reason.
public String getFileName();
Returns the name of the last file successfully opened with this dialog box; returns null if the last attempt failed or if the dialog box has never been used to open a file.