How do I check if a file typed in by the user in the FileDialog exist in the directory. if the file is not found or existed in teh directory a certain message is displayed. I do not know how to do that. Could I get some help.
FileDialog fileWindow = new FileDialog(new Frame(),"Tash & David's File Founder System");
fileWindow.setVisible(true);
if (fileWindow.getFile() != null) {
File fileDirectory = new File(fileWindow.getDirectory());
String[] Directory = fileDirectory.list();
for (; i < Directory.length; i++) {
if(Directory[i].startsWith(fileWindow.getFile())){
System.out.print("yes");
}
}
}
else
JOptionPane.showConfirmDialog(null, "Are you Sure");
}