• 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

Shutdown Hook

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Swing Application how to handle ShutDown operation for eg. like displaying Dialog box with modified files before existing SwingApplication.

I tried with Runtime.addShutDownHook() it is not possible display the Dialog Box, as AWT Thread is also in Shut Down Process. I Observed in NetBeansIDE my requirement is working fine.

Can any one knows about it or how it is implemented in NetBeans.

thanx in advance
Manju
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
should be easy
show the dialog in the windowlistener before System.exit() is invoked.
 
Manjunatha N.S.
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
winowListener is called in Normal Exit, but if you do end Task of your application in TaskManager, how to handle this scenario.

This is done NetBeans3.6 IDE, if do some modification and end task of NetBeansIDE Dialog box asks for saving.

any Idea how it is done NetBeans

thanks
Manju
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manjunatha,

Now, what exactly are you talking about? I have run netbeans 3.6 in
Windows XP, and when I killed both processes runide in the taskmanager,
netbeans just disappeared without a wink.

Or are you talking about Unix window manager close command? Then
it really would be:

as Sander has posted.

Best regards,
Petr
 
Manjunatha N.S.
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

On Windows, if you have NetBeans and you done some modfication to file in Netbeans Editor & in Windows Task Manager "Application" Tab select NetBeans 3.6 and end task then it will ask user to save before existing.

May be what you have done is in Windows Task Manager under "Processes" tab if you kill runide.exe, this is wonot ask user to save, this case documented in Runtime.addShutdownHook().

what i wanted know how it works in the 1st case I mentioned.

Hope it is clear.

thanks
Manjunatha



 
Petr Blahos
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right. Indeed I did End Process on processes tab. This "End Process"
on Applications tab is equivalent to pressing the little cross on
the top-right of the window and therefore my previous post applies.
I've just tried following and it worked.


P.
 
reply
    Bookmark Topic Watch Topic
  • New Topic