Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FileDialog

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic