@ProviderType
public interface Platform
Platform into an OSGi
service. IoCFX will make sure this service does not become available before
the JavaFX platform has been launched, so any DS declaring a dependency on
Platform will only be activated when it is safe to
use the JavaFX Platform.| Type | Property and Description |
|---|---|
javafx.beans.property.ReadOnlyBooleanProperty |
accessibilityActive
Indicates whether or not accessibility is active.
|
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.ReadOnlyBooleanProperty |
accessibilityActiveProperty()
Indicates whether or not accessibility is active.
|
void |
assertFxApplicationThread()
Assert that the current code is running on the JavaFX Application Thread.
|
void |
exit()
Causes the JavaFX application to terminate.
|
boolean |
isAccessibilityActive()
Gets the value of the property accessibilityActive.
|
boolean |
isFxApplicationThread()
Returns true if the calling thread is the JavaFX Application Thread.
|
boolean |
isImplicitExit()
Gets the value of the implicitExit attribute.
|
boolean |
isSupported(javafx.application.ConditionalFeature feature)
Queries whether a specific conditional feature is supported by the platform.
|
void |
runAndWait(Runnable runnable)
Run the specified Runnable on the JavaFX Application Thread at some
unspecified time in the future.
|
void |
runLater(Runnable runnable)
Run the specified Runnable on the JavaFX Application Thread at some
unspecified time in the future.
|
void |
runOnFxApplicationThread(Runnable runnable)
Run the specified Runnable on the JavaFX Application Thread at some
unspecified time in the future.
|
ScheduledFuture<Void> |
runOnFxApplicationThread(Runnable runnable,
long delay,
TimeUnit unit)
Will dispatch the provided
Runnable to the JavaFX Application Thread
after the given delay. |
void |
setImplicitExit(boolean implicitExit)
Sets the implicitExit attribute to the specified value.
|
javafx.beans.property.ReadOnlyBooleanProperty accessibilityActiveProperty
This method may be called from any thread.
isAccessibilityActive()javafx.beans.property.ReadOnlyBooleanProperty accessibilityActiveProperty()
This method may be called from any thread.
isAccessibilityActive()void exit()
This method may be called from any thread.
Note: if the application is embedded in a browser, then this method may have no effect.
boolean isAccessibilityActive()
This method may be called from any thread.
boolean isFxApplicationThread()
boolean isImplicitExit()
This method may be called from any thread.
boolean isSupported(javafx.application.ConditionalFeature feature)
For example:
// Query whether filter effects are supported
if (Platform.isSupported(ConditionalFeature.EFFECT)) {
// use effects
}
feature - the conditional feature in question.true iff the feature is supported, false otherwisevoid runLater(Runnable runnable)
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.
Platform.runLater(Runnable), this
method will never throw an IllegalStateException, because the Platform
service is only created once the JavaFX Platform has been initialized.runnable - the Runnable whose run method will be executed on the JavaFX
Application Threadvoid runOnFxApplicationThread(Runnable runnable)
runLater(Runnable), except that when it is called from the JavaFX
Application thread, it will not add the Runnable to the thread's
queue, but instead execute it immediately.runnable - the Runnable whose run method will be executed on the JavaFX
Application Threadvoid runAndWait(Runnable runnable) throws InterruptedException
runLater(Runnable), except that it blocks the calling thread until
the provided Runnable has been executed.runnable - the Runnable whose run method will be executed on the JavaFX
Application ThreadInterruptedException - if the calling thread is interrupted while waiting for the
specified Runnable to complete execution on the JavaFX
Application Threadvoid assertFxApplicationThread()
IllegalStateException.
This method is mainly intended to be used to validate the behavior of an Application in development. It should not be abused for control flow! Future versions of IoCFX may provide a way to turn this function into a no-op via configuration to avoid the overhead of checking the thread on sufficiently tested production systems.
IllegalStateException - if the calling thread is not the JavaFX Application Threadvoid setImplicitExit(boolean implicitExit)
Application.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 exit(). The default value is true.
This method may be called from any thread.
implicitExit - a flag indicating whether or not to implicitly exit when the last
window is closed.ScheduledFuture<Void> runOnFxApplicationThread(Runnable runnable, long delay, TimeUnit unit)
Runnable to the JavaFX Application Thread
after the given delay. Note that the actual time between calling this method
and the execution of the provided Runnable may be significantly longer than
the specified delay, if the JavaFX Application Thread is under heavy load.runnable - a runnable to be dispatched to the JavaFX Application Threaddelay - time after which the runnable will be dispatchedunit - the time unit of the delay parameterCopyright © 2019. All rights reserved.