API REVIEW request for RT-15011: Provide ability to alter the implicit "exit on last window closed" behavior

Kevin Rushforth kevin.rushforth at oracle.com
Wed Apr 18 10:02:04 PDT 2012


JIRA:  http://javafx-jira.kenai.com/browse/RT-15011

This is a simple API addition to address the need for applications to be 
able to inhibit the implicit "exit on last window closed" behavior of 
the JavaFX Platform.

To address this feature, I propose to add the following pair of methods 
to the Application class.

    public final void setImplicitExit(boolean implicitExit)
    public final boolean isImplicitExit()

The default value is true which preserves the existing behavior.

Here are the details:

=================================================

A. The Life-cycle section in the class header will be modified as follows:

The JavaFX runtime does the following, in order, whenever an application 
is launched:

    1. Constructs an instance of the specified Application class
    2. Calls the init() method
    3. Calls the start(Stage) method
    4. Waits for the application to finish, which happens when either of 
the following occur:
        * - the application calls Platform.exit()
        * - the last window has been closed and the implicitExit 
attribute is true
    5. Calls the stop() method

B. The proposed javadoc for the new methods is:

public final void setImplicitExit(boolean implicitExit)

Sets the implicitExit attribute to the specified value. If this 
attribute is true, the JavaFX runtime will implicitly shutdown when the 
last window is closed; the JavaFX launcher will call the stop() method 
and terminate the JavaFX application thread. If this attribute is false, 
the application will continue to run normally even after the last window 
is closed, until the application calls Platform.exit(). The default 
value is true.

    Parameters:
        implicitExit - a flag indicating whether or not to implicitly 
exit when the last window is closed.


public final boolean isImplicitExit()

Gets the value of the implicitExit attribute.

=================================================

Thanks.

-- Kevin



More information about the openjfx-dev mailing list