Microsoft SDK for Java

Handling Application Events

Use the Application object to assign event handlers for five different events that occur in the context of the application: ApplicationExit, OnIdle, SettingChange, SystemShutdown, and ThreadException. The following addOn methods can be called to define event handlers for these events.

Application Method Description
addOnApplicationExit Specifies a handler that is called when the application quits. You can clean up application resources here that will not be released by garbage collection. (To force the application not to quit, specify a handler for the form’s closing event.)
addOnIdle Specifies a handler that is called when the application’s message queue is idle; for example, to perform background operations or application cleanup.
addOnSettingChange Specifies a handler that is called when the user changes window settings.
addOnSystemShutdown Specifies a handler that is called immediately before a system shutdown is initiated by a user. This provides an opportunity to save data.
addOnThreadException Specifies a handler that is called when an untrapped Java exception has been thrown, allowing the application to correctly handle the exception. This event handler takes a com.ms.wfc.app.ThreadExceptionEvent object, which has one field that represents the exception thrown.

All these addOn methods have reciprocal removeOn methods to remove the event handler.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.