Ho risolto .
Mi è bastato aggiungere queste righe di codice:

if(result ==JOptionPane.CANCEL_OPTION)
throw new PropertyVetoException("User Canceled close",event);


:metallica :metallica :metallica Tnx