Platform
Application platform support, wrapper for javafx.application.Platform.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Platform.type
Members list
Type members
Classlikes
Contains UI preferences of the current platform, wrapper for javafx.application.Platform.Preferences
Contains UI preferences of the current platform, wrapper for javafx.application.Platform.Preferences
Attributes
- Since
-
JavaFX 22
- Companion
- object
- Supertypes
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Preferences.type
Value members
Concrete methods
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.
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.
Attributes
- Returns
-
the read-only boolean property indicating if accessibility is active
- Since
-
JavaFX 8u40
Indicates whether a nested event loop can be started from the current thread in the current state. A nested event loop can be started from an event handler or from a Runnable passed to runLater. This method must be called on the JavaFX Application thread.
Indicates whether a nested event loop can be started from the current thread in the current state. A nested event loop can be started from an event handler or from a Runnable passed to runLater. This method must be called on the JavaFX Application thread.
Attributes
- Returns
-
trueif a nested event loop can be started, andfalseotherwise. - Throws
-
IllegalStateException
if this method is called on a thread other than the JavaFX Application Thread.
- Since
-
21
Enter a nested event loop and block until the corresponding exitNestedEventLoop call is made. The key passed into this method is used to uniquely identify the matched enter/exit pair. This method creates a new nested event loop and blocks until the corresponding exitNestedEventLoop method is called with the same key. The return value of this method will be the rval object supplied to the exitNestedEventLoop method call that unblocks it.
Enter a nested event loop and block until the corresponding exitNestedEventLoop call is made. The key passed into this method is used to uniquely identify the matched enter/exit pair. This method creates a new nested event loop and blocks until the corresponding exitNestedEventLoop method is called with the same key. The return value of this method will be the rval object supplied to the exitNestedEventLoop method call that unblocks it.
This method must either be called from an input event handler or from the run method of a Runnable passed to javafx.application.Platform.runLater. It must not be called during animation or layout processing.
Value parameters
- key
-
the Object that identifies the nested event loop, which must not be null
Attributes
- Returns
-
the value passed into the corresponding call to exitEventLoop
- Throws
-
IllegalArgumentException
if the specified key is associated with a nested event loop that has not yet returned
IllegalStateExceptionif this method is called on a thread other than the JavaFX Application Thread.
NullPointerExceptionif the key is null
- Since
-
9
Causes the JavaFX application to terminate.
Causes the JavaFX application to terminate.
Attributes
Exit a nested event loop and unblock the caller of the corresponding enterNestedEventLoop. The key passed into this method is used to uniquely identify the matched enter/exit pair. This method causes the nested event loop that was previously created with the key to exit and return control to the caller. If the specified nested event loop is not the inner-most loop then it will not return until all other inner loops also exit.
Exit a nested event loop and unblock the caller of the corresponding enterNestedEventLoop. The key passed into this method is used to uniquely identify the matched enter/exit pair. This method causes the nested event loop that was previously created with the key to exit and return control to the caller. If the specified nested event loop is not the inner-most loop then it will not return until all other inner loops also exit.
Value parameters
- key
-
the Object that identifies the nested event loop, which must not be null
- rval
-
an Object that is returned to the caller of the corresponding enterNestedEventLoop. This may be null.
Attributes
- Throws
-
IllegalArgumentException
if the specified key is not associated with an active nested event loop
IllegalStateExceptionif this method is called on a thread other than the FX Application thread
NullPointerExceptionif the key is null
- Since
-
9
Gets the value of the implicitExit attribute.
Gets the value of the implicitExit attribute.
Attributes
Sets the implicitExit attribute to the specified value.
Sets the implicitExit attribute to the specified value.
Attributes
Returns true if the calling thread is the JavaFX Application Thread.
Returns true if the calling thread is the JavaFX Application Thread.
Attributes
Returns a flag indicating whether the key corresponding to keyCode is in the locked (or "on") state. keyCode must be one of: KeyCode.Caps or KeyCode.NumLock. If the underlying system is not able to determine the state of the specified keyCode, None is returned. If the keyboard attached to the system doesn't have the specified key, an Some[False] is returned. This method must be called on the JavaFX Application thread.
Returns a flag indicating whether the key corresponding to keyCode is in the locked (or "on") state. keyCode must be one of: KeyCode.Caps or KeyCode.NumLock. If the underlying system is not able to determine the state of the specified keyCode, None is returned. If the keyboard attached to the system doesn't have the specified key, an Some[False] is returned. This method must be called on the JavaFX Application thread.
Value parameters
- keyCode
-
the
keyCodeof the lock state to query
Attributes
- Returns
-
the lock state of the key corresponding to
keyCode, or None if the system cannot determine its state - Throws
-
IllegalArgumentException
if
keyCodeis not one of the validkeyCodevaluesIllegalStateExceptionif this method is called on a thread other than the JavaFX Application Thread
- Since
-
17
Checks whether a nested event loop is running, returning true to indicate that one is, and false if there are no nested event loops currently running. This method must be called on the JavaFX Application thread.
Checks whether a nested event loop is running, returning true to indicate that one is, and false if there are no nested event loops currently running. This method must be called on the JavaFX Application thread.
Attributes
- Returns
-
true if there is a nested event loop running, and false otherwise.
- Throws
-
IllegalStateException
if this method is called on a thread other than the JavaFX Application Thread.
- Since
-
9
Queries whether a specific conditional feature is supported by the platform.
Queries whether a specific conditional feature is supported by the platform.
Attributes
Gets the preferences of the current platform, wraps Platform#getPreferences
Requests the Java Runtime to perform a pulse. This will run a pulse even if there are no animation timers, scene graph modifications, or window events that would otherwise cause the pulse to run. If no pulse is in progress, then one will be scheduled to run the next time the pulse timer fires. If there is already a pulse running, then at least one more pulse after the current pulse will be scheduled. This method may be called on any thread.
Requests the Java Runtime to perform a pulse. This will run a pulse even if there are no animation timers, scene graph modifications, or window events that would otherwise cause the pulse to run. If no pulse is in progress, then one will be scheduled to run the next time the pulse timer fires. If there is already a pulse running, then at least one more pulse after the current pulse will be scheduled. This method may be called on any thread.
Attributes
- Since
-
9
Run the specified Runnable on the JavaFX Application Thread at some unspecified time in the future. Returns immediately.
Run the specified Runnable on the JavaFX Application Thread at some unspecified time in the future. Returns immediately.
Attributes
Run the specified code block on the JavaFX Application Thread at some unspecified time in the future. Returns immediately.
Run the specified code block on the JavaFX Application Thread at some unspecified time in the future. Returns immediately.
Example use:
Platform.runLater {
println("Running on application thread.")
}
Attributes
This method starts the JavaFX runtime. The specified Runnable will then be called on the JavaFX Application Thread. In general it is not necessary to explicitly call this method, since it is invoked as a consequence of how most JavaFX applications are built. However there are valid use cases for calling this method directly. Because this method starts the JavaFX runtime, there is not yet any JavaFX Application Thread, so it is normal that this method is called directly on the main thread of the application.
This method starts the JavaFX runtime. The specified Runnable will then be called on the JavaFX Application Thread. In general it is not necessary to explicitly call this method, since it is invoked as a consequence of how most JavaFX applications are built. However there are valid use cases for calling this method directly. Because this method starts the JavaFX runtime, there is not yet any JavaFX Application Thread, so it is normal that this method is called directly on the main thread of the application.
This method may or may not return to the caller before the run method of the specified Runnable has been called. In any case, once this method returns, you may call runLater with additional Runnables. Those Runnables will be called, also on the JavaFX Application Thread, after the Runnable passed into this method has been called.
As noted, it is normally the case that the JavaFX Application Thread is started automatically. It is important that this method only be called when the JavaFX runtime has not yet been initialized. Situations where the JavaFX runtime is started automatically include:
-
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 automatically by the launcher before the
Applicationclass is loaded. -
For Swing applications that use javafx.embed.swing.JFXPanel to display FX content, the FX runtime is initialized when the first
JFXPanelinstance is constructed. -
For SWT application that use
FXCanvasto display FX content, the FX runtime is initialized when the firstFXCanvasinstance is constructed.
When an application does not follow any of these common approaches, then it becomes the responsibility of the developer to manually start the JavaFX runtime by calling this startup method.
Calling this method when the JavaFX runtime is already running will result in an IllegalStateException being thrown - it is only valid to request that the JavaFX runtime be started once.
Value parameters
- runnable
-
the Runnable whose run method will be executed on the JavaFX Application Thread once it has been started
Attributes
- Throws
-
IllegalStateException
if the JavaFX runtime is already running
- See also
-
Application
- Since
-
9