• 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

how to disable close window

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I hardly searching how to disable close window please help me i have below code how to use that code in servlet.If i integrated that code into servlet it will work fine? please ya help me i will follow in that

CODE:
=====

myDialog.setDefaultCloseOperation(
WindowConstants.DO_NOTHING_ON_CLOSE);
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets do not have Java GUIs, so the Swing code you posted is not applicable to them.

What kind of window are you talking about - a browser window? If so, note that that is a user-hostile thing to do. If the user wishes to close a window then a well-behaved application should not stop him from doing so.

What are you trying to accomplish?
[ July 23, 2008: Message edited by: Ulf Dittmer ]
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets run from within a browser and if you call a Swing GUI from within your servlet, then you can only control the Swing part of it.

But if you intend to disable the cloase button of the browser, then you have to try some Java scripts to do it.
 
saravanan rajendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi thanks for your reply i feel very difficult to do that.please help me actually i have crmpopup window using servlet it contain logout button. without pressing logout button they simply closed window means very problem database value wont change. for that i need to know how to disable close window button in crmpopup screen please give some idea if you know good link to get code please tell

thank you
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is a "crmpopup screen"? Is this a browser popup?

Could you not add an HttpSessionListener to perform the clean up code when the session is timed out?


But if you intend to disable the cloase button of the browser, then you have to try some Java scripts to do it.


It is not possible to catch all the various ways a browser window could be closed. For example, if a browser is process is killed any client side JavaScript can't run. Its not really worth the effort. As Ulf has already said, preventing the user using their browser exactly as they want to is not something its wise to do. You'll drive them up the wall.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic