Updated 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
Mon Apr 30 18:39:24 PDT 2012
[finally getting back to this]
While writing tests for this I realized that what I proposed earlier
won't work for Swing or SWT apps that embed a JavaFX Scene, but have no
Application class. As a result I'm going back to my original idea of
putting the implicitExit attribute on Platform (which is where exit() is
so it makes just as much sense, if not more, to be there anyway).
=================================================
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 Platform class.
public static void setImplicitExit(boolean implicitExit)
public static boolean isImplicitExit()
The default value is true which preserves the existing behavior.
Here are the details:
=================================================
A. The Life-cycle section in the Application 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 on Platform is true
5. Calls the stop() method
B. The proposed javadoc for the new methods in Platform is:
public static 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 static boolean isImplicitExit()
Gets the value of the implicitExit attribute.
=================================================
Thanks.
-- Kevin
More information about the openjfx-dev
mailing list