> As it happens in usual window programs. When you choose 'open' option
> from the menu and then if you enters a file name which does not exists,
> an appropriate message is displayed which mentions that 'file does not
> exists'. But when you perform such action while using the "FileDialog"
> class of java.awt no appropriate message appears and file dialog just
> disappears. WHY? Can't we arrange 'EXACTLY THE SAME' mechanism for
> java.awt.FileDialog class, if yes, please clarify it with example. Thank
> you.
After opening a file you can test if the file really exists, I used it in
one of my own programms (note I used SWING components):
JFileChooser FileChoose = new JFileChooser();
if ( (FileChoose.getSelectedFile()).exists() )
{
// Do something with the file
}
else
{
// Make an error message, like:
JOptionPane.showMessageDialog(
this, "That file does not exist y!", "File error",
JOptionPane.ERROR_MESSAGE);
}
Hope you can use it!
David Martens