I need a Open file Dialog. 
 
I was seeing the JFileChooser and I did this class.
 
public class JDialogFileOpen extends JFileChooser {
   public int showDialog(Component arg0, String arg1)
        throws HeadlessException {
        while (true) {
            int nOption = super.showDialog(arg0, arg1);
            if (nOption != JDialogFileOpen.APPROVE_OPTION) {
                return nOption;
            } else {
                File file = this.getSelectedFile();
                if (file.exists() && file.isFile()) {
                    return nOption;                
                } else {
                    JOptionPane.showMessageDialog(
                        this, 
                        file.getPath()+"\nFile not found.", 
                        null, 
                        JOptionPane.ERROR_MESSAGE);
                }
            }
        }
    }
}
 
When the file does not exists shows a error message and reshow the
JFileChooser.
 
I don't want the JFileChooser to desapear. Is this possible?
 
Thanks
Marcos
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to