• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Window Closing Event

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Guys,
I have the following code for window closing event
--------
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
int exitApp= JOptionPane.showConfirmDialog(null,
"Do you really wish to exit the application", "Please Confirm", JOptionPane.YES_NO_OPTION);
if (exitApp==JOptionPane.YES_OPTION){
System.exit(0);
}
}
});
---------
When i am closing the window, the message is getting displayed. If i choose NO for closing the window is not remaining. It is just disappearing. I am sure it is not closing.
How do i make sure that, the window remains there, when i choose the NO option for the confirmation message???
any suggestions willbe greatly appreciated.

thanks in advance.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Then you can handle it in your windowCLosing() and it will do only what you specify inside that method.
 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
It works.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic