--- a/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java +++ b/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java @@ -5704,6 +5707,18 @@ return getProperties().get(USER_DATA_KEY); } + final ScenePreferences preferences = new ScenePreferences(this); + + /** + * Gets the scene preferences that can override {@link Platform.Preferences platform} preferences. + * + * @return the {@code Preferences} instance + * @since 25 + */ + public final Preferences getPreferences() { + return preferences; + } + /* ************************************************************************* * * * Component Orientation Properties * @@ -5961,5 +5976,160 @@ } return accessible; } + + /** + * Contains scene preferences that can override {@link Platform.Preferences platform} preferences. + *
+ * All preferences are null-coalesting properties: if set to {@code null} (using the setter method, + * {@link Property#setValue(Object)}, or with a binding), the property evalutes to the value of the corresponding + * platform-provided preference. Likewise, specifying a non-null value for any given property will override the + * platform-provided value. + * + * @see Platform.Preferences + * @since 25 + */ + public sealed interface Preferences permits ScenePreferences { + + /** + * Specifies whether applications should always show scroll bars. If set to {@code false}, applications + * may choose to hide scroll bars that are not actively used, or make them smaller or less noticeable. + *
+ * This property corresponds to the
+ * {@code -fx-prefers-persistent-scrollbars} media feature.
+ *
+ * @return the {@code persistentScrollBars} property
+ * @defaultValue {@link Platform.Preferences#isPersistentScrollBars()}
+ * @see Platform.Preferences#persistentScrollBarsProperty()
+ */
+ ObjectProperty
+ * This property corresponds to the
+ * {@code prefers-reduced-motion} media feature.
+ *
+ * @return the {@code reducedMotion} property
+ * @defaultValue {@link Platform.Preferences#isReducedMotion()}
+ * @see Platform.Preferences#reducedMotionProperty()
+ */
+ ObjectProperty
+ * This property corresponds to the
+ * {@code prefers-reduced-transparency} media feature.
+ *
+ * @return the {@code reducedTransparency} property
+ * @defaultValue {@link Platform.Preferences#isReducedTransparency()}
+ * @see Platform.Preferences#reducedTransparencyProperty()
+ */
+ ObjectProperty
+ * This property corresponds to the
+ * {@code prefers-reduced-data} media feature.
+ *
+ * @return the {@code reducedData} property
+ * @defaultValue {@link Platform.Preferences#isReducedData()}
+ * @see Platform.Preferences#reducedDataProperty()
+ */
+ ObjectProperty
+ * This property corresponds to the
+ * {@code prefers-color-scheme} media feature.
+ *
+ * @return the {@code colorScheme} property
+ * @defaultValue {@link Platform.Preferences#getColorScheme()}
+ * @see Platform.Preferences#colorSchemeProperty()
+ */
+ ObjectProperty
- * If the platform does not report this preference, this property defaults to {@code false}.
+ * This property corresponds to the
+ * {@code -fx-prefers-persistent-scrollbars} media feature.
*
* @return the {@code persistentScrollBars} property
* @defaultValue {@code false}
@@ -627,7 +628,8 @@
* Specifies whether applications should minimize the amount of non-essential animations,
* reducing discomfort for users who experience motion sickness or vertigo.
*
- * If the platform does not report this preference, this property defaults to {@code false}.
+ * This property corresponds to the
+ * {@code prefers-reduced-motion} media feature.
*
* @return the {@code reducedMotion} property
* @defaultValue {@code false}
@@ -641,7 +643,8 @@
* Specifies whether applications should minimize the amount of transparent or translucent
* layer effects, which can help to increase contrast and readability for some users.
*
- * If the platform does not report this preference, this property defaults to {@code false}.
+ * This property corresponds to the
+ * {@code prefers-reduced-transparency} media feature.
*
* @return the {@code reducedTransparency} property
* @defaultValue {@code false}
@@ -655,7 +658,8 @@
* Specifies whether applications should minimize the amount of internet traffic, which users
* might request because they are on a metered network or a limited data plan.
*
- * If the platform does not report this preference, this property defaults to {@code false}.
+ * This property corresponds to the
+ * {@code prefers-reduced-data} media feature.
*
* @return the {@code reducedData} property
* @defaultValue {@code false}
@@ -669,7 +673,8 @@
* The platform color scheme, which specifies whether applications should prefer light text on
* dark backgrounds, or dark text on light backgrounds.
*
- * If the platform does not report color preferences, this property defaults to {@code LIGHT}.
+ * This property corresponds to the
+ * {@code prefers-color-scheme} media feature.
*
* @return the {@code colorScheme} property
* @defaultValue {@link ColorScheme#LIGHT}
@@ -680,8 +685,6 @@
/**
* The color used for background regions.
- *
- * If the platform does not report a background color, this property defaults to {@code WHITE}.
*
* @return the {@code backgroundColor} property
* @defaultValue {@link Color#WHITE}
@@ -692,8 +695,6 @@
/**
* The color used for foreground elements like text.
- *
- * If the platform does not report a foreground color, this property defaults to {@code BLACK}.
*
* @return the {@code foregroundColor} property
* @defaultValue {@link Color#BLACK}
@@ -706,9 +707,6 @@
* The accent color, which can be used to highlight the active or important part of a
* control and make it stand out from the rest of the user interface. It is usually a
* vivid color that contrasts with the foreground and background colors.
- *
- * If the platform does not report an accent color, this property defaults to vivid blue
- * (corresponding to the hex color value {@code #157EFB}).
*
* @return the {@code accentColor} property
* @defaultValue {@code #157EFB}
--- a/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html
+++ b/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html
@@ -777,9 +777,10 @@
Beginning with JavaFX 8u20, the CSS
- @import is also partially supported.
+ @import is partially supported.
Only unconditional import is supported. In other words, the media‑type qualifier is not supported.
Also, the JavaFX CSS parser is non-compliant with regard to where an @import may appear within a stylesheet
(see At‑rules).
@@ -785,6 +786,7 @@
(see At‑rules).
Users are cautioned that this will be fixed in a future release. Adherence to the W3C standard is strongly advised.
Since JavaFX 8, the implementation partially supports the CSS3 syntax to load a font from a URL using the
@font‑face rule:@ Rules
+ @import
@font-face