Gente, tenho um JFileChooser, que funciona certo quando eu tento abrir um arqui, porem, quando eu clico na opção cancelar dah erro.
public void actionPerformed(ActionEvent e) {
fc = new JFileChooser(principal.mp.getCaminho());
int result = fc.showOpenDialog(null);
String path = fc.getSelectedFile().getParent();
principal.mp.setCaminho(path);
switch (result) {
case JFileChooser.APPROVE_OPTION:
File f = (fc.getSelectedFile());
if (f.toString().toLowerCase().endsWith(".map")) {
try {
new Janela(principal, f);
} catch (FileNotFoundException ex) {
Logger.getLogger(JanelaHum.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(JanelaHum.class.getName()).log(Level.SEVERE, null, ex);
}
}//end if
dispose();
break;
case JFileChooser.CANCEL_OPTION:
System.exit(0);
break;
case JFileChooser.ERROR_OPTION:
JOptionPane.showMessageDialog(null, "Caminho nao encontrado!");
break;
}//end switch
}//end metodo
});//end internal class
Alguém sabe o motivo?
