Class Platform
- javafx.application.Platform
public final class Platform extends Object
Since:
JavaFX 2.0
-
Property Summary
All MethodsStatic MethodsConcrete Methods Type Property and Description static ReadOnlyBooleanPropertyaccessibilityActiveIndicates whether or not accessibility is active.
-
Method Summary
All MethodsStatic MethodsConcrete Methods Modifier and Type Method and Description static ReadOnlyBooleanPropertyaccessibilityActiveProperty()Indicates whether or not accessibility is active.static voidexit()Causes the JavaFX application to terminate.static booleanisAccessibilityActive()Gets the value of the property accessibilityActive.static booleanisFxApplicationThread()Returns true if the calling thread is the JavaFX Application Thread.static booleanisImplicitExit()Gets the value of the implicitExit attribute.static booleanisSupported(ConditionalFeature feature)Queries whether a specific conditional feature is supported by the platform.static voidrunLater(Runnable runnable)Run the specified Runnable on the JavaFX Application Thread at some unspecified time in the future.static voidsetImplicitExit(boolean implicitExit)Sets the implicitExit attribute to the specified value.
-
Property Detail
-
accessibilityActive
public static ReadOnlyBooleanProperty accessibilityActiveProperty
Indicates whether or not accessibility is active. This property is typically set to true the first time an assistive technology, such as a screen reader, requests information about any JavaFX window or its children.This method may be called from any thread.
Since:
JavaFX 8u40
See Also:
-
-
Method Detail
-
runLater
public static void runLater(Runnable runnable)
Run the specified Runnable on the JavaFX Application Thread at some unspecified time in the future. This method, which may be called from any thread, will post the Runnable to an event queue and then return immediately to the caller. The Runnables are executed in the order they are posted. A runnable passed into the runLater method will be executed before any Runnable passed into a subsequent call to runLater. If this method is called after the JavaFX runtime has been shutdown, the call will be ignored: the Runnable will not be executed and no exception will be thrown.NOTE: applications should avoid flooding JavaFX with too many pending Runnables. Otherwise, the application may become unresponsive. Applications are encouraged to batch up multiple operations into fewer runLater calls. Additionally, long-running operations should be done on a background thread where possible, freeing up the JavaFX Application Thread for GUI operations.
This method must not be called before the FX runtime has been initialized. For standard JavaFX applications that extend
Application, and use either the Java launcher or one of the launch methods in the Application class to launch the application, the FX runtime is initialized by the launcher before the Application class is loaded. For Swing applications that use JFXPanel to display FX content, the FX runtime is initialized when the first JFXPanel instance is constructed. For SWT application that use FXCanvas to display FX content, the FX runtime is initialized when the first FXCanvas instance is constructed.Parameters:
runnable- the Runnable whose run method will be executed on the JavaFX Application ThreadThrows:
IllegalStateException- if the FX runtime has not been initialized
-
isFxApplicationThread
public static boolean isFxApplicationThread()
Returns true if the calling thread is the JavaFX Application Thread. Use this call the ensure that a given task is being executed (or not being executed) on the JavaFX Application Thread.Returns:
true if running on the JavaFX Application Thread
-
exit
public static void exit()
Causes the JavaFX application to terminate. If this method is called after the Application start method is called, then the JavaFX launcher will call the Application stop method and terminate the JavaFX application thread. The launcher thread will then shutdown. If there are no other non-daemon threads that are running, the Java VM will exit. If this method is called from the Preloader or the Application init method, then the Application stop method may not be called.This method may be called from any thread.
Note: if the application is embedded in a browser, then this method may have no effect.
-
setImplicitExit
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 theApplication.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 callsexit(). The default value is true.This method may be called from any thread.
Parameters:
implicitExit- a flag indicating whether or not to implicitly exit when the last window is closed.Since:
JavaFX 2.2
-
isImplicitExit
public static boolean isImplicitExit()
Gets the value of the implicitExit attribute.This method may be called from any thread.
Returns:
the implicitExit attribute
Since:
JavaFX 2.2
-
isSupported
public static boolean isSupported(ConditionalFeature feature)
Queries whether a specific conditional feature is supported by the platform.For example:
// Query whether filter effects are supported if (Platform.isSupported(ConditionalFeature.EFFECT)) { // use effects }Parameters:
feature- the conditional feature in question.
-
isAccessibilityActive
public static boolean isAccessibilityActive()
Gets the value of the property accessibilityActive.Property description:
Indicates whether or not accessibility is active. This property is typically set to true the first time an assistive technology, such as a screen reader, requests information about any JavaFX window or its children.
This method may be called from any thread.
Since:
JavaFX 8u40
-
accessibilityActiveProperty
public static ReadOnlyBooleanProperty accessibilityActiveProperty()
Indicates whether or not accessibility is active. This property is typically set to true the first time an assistive technology, such as a screen reader, requests information about any JavaFX window or its children.This method may be called from any thread.
Since:
JavaFX 8u40
See Also:
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.