It won't throw an exception, its not something unexpected occurring. As my memory serves from seeing the SWT samples you have a loop checking that the application is still active, when it isn't it exits the loop. If its like other toolkits like GTK, you would have a listener for the event when the main window is destroyed, which would then tell the application its time to exit.
Also on linux you shouldn't kill it with control+c, again go through the proper toolkit way of notifying things of exiting, closing the main window would seem the logical event to trigger the exit code. As you are listening for the window close event you need not know how the user caused that, alt+f4, command+q, selecting exit from the menu, etc.
Michael Whapples On 27/11/10 01:24, John J. Boyer wrote:
I am talking about the Java program as a whole. Alt-f4 terminatges GUI programs on Windows. What is the corresponding keystroke o n the Mac? The subcommands will usually start the GUI in special modes, such as a bare-bones text editor. So if a user hits alt-f4 I suppose the jre will throw an exception. I want to catch that exception and try to terminate gracefully. Can I do it in the main method? John On Fri, Nov 26, 2010 at 11:27:12AM -0800, Alex Jurgensen wrote:Hi John, Are we talking on the command-line or from the GUI? The commands you listed for the Mac nd Linux are the ones used to xit programs on the command-line before they have completed. Regards, Alex, On 2010-11-26, at 11:09 AM, John J. Boyer wrote:What happens of someone gets disgusted with the way things are going and hits alt-f4 in Windows or control-c in Mac or Linux? Suppose a fatal runtime error occurs? What exceptions will Java throw? Can I catch them in the main method and attempt to clean things up before exiting? Thanks, John -- John J. Boyer; President, Chief Software Developer Abilitiessoft, Inc. http://www.abilitiessoft.com Madison, Wisconsin USA Developing software for people with disabilitiesAlex Jurgensen, VoiceOver Trainer, ASquared21@xxxxxxxxxxxxxxxxx Visit us on the web at: www.vipbc.org