I would like to check if the file name inserted by the user match the name of a the file in the directory
<p>I would like to know how to check if a file exists in the directory or if the name of the file typed in by the  user matches what is in the directory and if it dont i out put a certain msg.. I  am using FileDialog. That is if the user types in the name of a file it loops through the directory
for a file with that name. If no match is found then a message should be printed.</p>

<pre><code>    FileDialog fileWindow = 
       new FileDialog(new Frame(), "Tash &amp; David's File Founder System");
    fileWindow.setVisible(true);

    if (fileWindow.getFile() != null) {         
        File fileDirectory = new File(fileWindow.getDirectory());           
        String[] Directory = fileDirectory.list();          
        for (; i &lt; Directory.length; i++) {                         
            if(Directory[i].startsWith(fileWindow.getFile())){              
                System.out.print("yes");                                    
            }                            
        }                       
    }
    else
        JOptionPane.showConfirmDialog(null, "Are you Sure");
    }
</code></pre>
