Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileDialog

 
ritu mahendru
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i want that when user clicks on the close button of the JInternal frame,
and if there are changes that are to be saved
a Save File dialog box should be poped up
till this point everything is working fine
but if instead of clicking on the save button
user clicks on the cancel button then the Internal frame is also getting disposed
whereas only the File dialog should get disposed
please respond to the problem soon
bye
ritu
the
 
Rajesh Kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
Hope this code will be helpful to u.

if (mFile.mBool_modified) {
int nRtn = JOptionPane.showConfirmDialog(this,"Not saved project! would you save the project?"
,"Yes to save",JOptionPane.YES_NO_CANCEL_OPTION);
if (nRtn == JOptionPane.YES_OPTION) {
int nSave =mFile.save(false, null);
if (nSave == HwDocument._SAVE_NOERROR) {
System.out.println("promt saved");
setInfo("[" + mFile.mStr_fileFullPath + " - " + mFile.mStr_projectName + "] saved");
} else {
setInfo("[" + mFile.mStr_fileFullPath + " - " + mFile.mStr_projectName + "] failed to save");
JOptionPane.showMessageDialog(this
,"cannot save the project[" + mFile.mStr_fileFullPath + " - " + mFile.mStr_projectName
+ "]...\nplease, try later"
,"Project save error",JOptionPane.WARNING_MESSAGE);
return false;
}
}
else if (nRtn == JOptionPane.CANCEL_OPTION)
{
System.out.println("From CANCEL_OPTION");
}
}
Cheers
Rajesh
Originally posted by ritu mahendru:
hi
i want that when user clicks on the close button of the JInternal frame,
and if there are changes that are to be saved
a Save File dialog box should be poped up
till this point everything is working fine
but if instead of clicking on the save button
user clicks on the cancel button then the Internal frame is also getting disposed
whereas only the File dialog should get disposed
please respond to the problem soon
bye
ritu
the

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic