Interface Application.ExitListener

All Superinterfaces:
EventListener
Enclosing class:
Application

public static interface Application.ExitListener extends EventListener
Gives the Application a chance to veto an attempt to exit/quit. An ExitListener's canExit method should return false if there are pending decisions that the user must make before the app exits. A typical ExitListener would prompt the user with a modal dialog.

The eventObject argument will be the the value passed to exit(). It may be null.

The willExit method is called after the exit has been confirmed. An ExitListener that's going to perform some cleanup work should do so in willExit.

ExitListeners run on the event dispatching thread.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The method is called before the Application exits.
    void
    The method is called after the exit has been confirmed.
  • Method Details

    • canExit

      boolean canExit(EventObject event)
      The method is called before the Application exits.
      Parameters:
      event - the EventObject object. It will be the the value passed to exit().
      Returns:
      true if application can proceed with shutdown process; false if there are pending decisions that the user must make before the app exits.
    • willExit

      void willExit(EventObject event)
      The method is called after the exit has been confirmed.
      Parameters:
      event - the EventObject object. It will be the the value passed to exit().