JInternalFrame listener...help!
Ok, i am making a paint program where the pictures are stored in JInternalFrames.
when the user closes a frame i have a InternalFrame listener as follows:
publicvoid internalFrameClosing(InternalFrameEvent e){
JInternalFrame fr = desktop.getSelectedFrame();
if(fr.getLayer() == JDesktopPane.DEFAULT_LAYER)
{
int response = JOptionPane.showConfirmDialog(null,"This will delete any unsaved changes, would you like to save?",
"Confirm Save",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE );
if (response == JOptionPane.CANCEL_OPTION)
{
//System.out.println("woof");
return;
}
if (response == JOptionPane.YES_OPTION)
{
doSave();
}
}
close();
}
for some reason when i press cancel it doesnt cancel the closing of the frame, i thought return would work but clearly not.
Is there any other way to stop the frame closing once the X has been clicked?
thanks

