- All Superinterfaces:
- Map<String,,- Object> - Observable,- ObservableMap<String,- Object> 
- Enclosing class:
- Platform
 Preferences extends ObservableMap to expose platform preferences as key-value pairs.
 The map is unmodifiable, which means that keys and values cannot be added, removed, or updated.
 Calling any mutator method on the map will always cause UnsupportedOperationException to be thrown.
 However, the mappings will be updated by JavaFX when the operating system reports that a platform
 preference has changed.
 
 For convenience, getInteger(java.lang.String), getDouble(java.lang.String), getBoolean(java.lang.String), getString(java.lang.String),
 getColor(java.lang.String), and getValue(java.lang.String, java.lang.Class<T>) are provided as typed alternatives to the untyped
 Map.get(java.lang.Object) method.
 
The preferences that are reported by the platform may be dependent on the operating system version and its current configuration, so applications should not assume that a particular preference is always available.
The following preferences are potentially available on the specified platforms:
| Windows.SPI.HighContrast | Boolean | 
| Windows.SPI.HighContrastColorScheme | String | 
| Windows.SysColor.COLOR_3DFACE | Color | 
| Windows.SysColor.COLOR_BTNTEXT | Color | 
| Windows.SysColor.COLOR_GRAYTEXT | Color | 
| Windows.SysColor.COLOR_HIGHLIGHT | Color | 
| Windows.SysColor.COLOR_HIGHLIGHTTEXT | Color | 
| Windows.SysColor.COLOR_HOTLIGHT | Color | 
| Windows.SysColor.COLOR_WINDOW | Color | 
| Windows.SysColor.COLOR_WINDOWTEXT | Color | 
| Windows.UIColor.Background | Color | 
| Windows.UIColor.Foreground | Color | 
| Windows.UIColor.AccentDark3 | Color | 
| Windows.UIColor.AccentDark2 | Color | 
| Windows.UIColor.AccentDark1 | Color | 
| Windows.UIColor.Accent | Color | 
| Windows.UIColor.AccentLight1 | Color | 
| Windows.UIColor.AccentLight2 | Color | 
| Windows.UIColor.AccentLight3 | Color | 
| macOS.NSColor.labelColor | Color | 
| macOS.NSColor.secondaryLabelColor | Color | 
| macOS.NSColor.tertiaryLabelColor | Color | 
| macOS.NSColor.quaternaryLabelColor | Color | 
| macOS.NSColor.textColor | Color | 
| macOS.NSColor.placeholderTextColor | Color | 
| macOS.NSColor.selectedTextColor | Color | 
| macOS.NSColor.textBackgroundColor | Color | 
| macOS.NSColor.selectedTextBackgroundColor | Color | 
| macOS.NSColor.keyboardFocusIndicatorColor | Color | 
| macOS.NSColor.unemphasizedSelectedTextColor | Color | 
| macOS.NSColor.unemphasizedSelectedTextBackgroundColor | Color | 
| macOS.NSColor.linkColor | Color | 
| macOS.NSColor.separatorColor | Color | 
| macOS.NSColor.selectedContentBackgroundColor | Color | 
| macOS.NSColor.unemphasizedSelectedContentBackgroundColor | Color | 
| macOS.NSColor.selectedMenuItemTextColor | Color | 
| macOS.NSColor.gridColor | Color | 
| macOS.NSColor.headerTextColor | Color | 
| macOS.NSColor.alternatingContentBackgroundColors | Color[] | 
| macOS.NSColor.controlAccentColor | Color | 
| macOS.NSColor.controlColor | Color | 
| macOS.NSColor.controlBackgroundColor | Color | 
| macOS.NSColor.controlTextColor | Color | 
| macOS.NSColor.disabledControlTextColor | Color | 
| macOS.NSColor.selectedControlColor | Color | 
| macOS.NSColor.selectedControlTextColor | Color | 
| macOS.NSColor.alternateSelectedControlTextColor | Color | 
| macOS.NSColor.currentControlTint | String | 
| macOS.NSColor.windowBackgroundColor | Color | 
| macOS.NSColor.windowFrameTextColor | Color | 
| macOS.NSColor.underPageBackgroundColor | Color | 
| macOS.NSColor.findHighlightColor | Color | 
| macOS.NSColor.highlightColor | Color | 
| macOS.NSColor.shadowColor | Color | 
| macOS.NSColor.systemBlueColor | Color | 
| macOS.NSColor.systemBrownColor | Color | 
| macOS.NSColor.systemGrayColor | Color | 
| macOS.NSColor.systemGreenColor | Color | 
| macOS.NSColor.systemIndigoColor | Color | 
| macOS.NSColor.systemOrangeColor | Color | 
| macOS.NSColor.systemPinkColor | Color | 
| macOS.NSColor.systemPurpleColor | Color | 
| macOS.NSColor.systemRedColor | Color | 
| macOS.NSColor.systemTealColor | Color | 
| macOS.NSColor.systemYellowColor | Color | 
| GTK.theme_name | String | 
| GTK.theme_fg_color | Color | 
| GTK.theme_bg_color | Color | 
| GTK.theme_base_color | Color | 
| GTK.theme_selected_bg_color | Color | 
| GTK.theme_selected_fg_color | Color | 
| GTK.theme_unfocused_fg_color | Color | 
| GTK.theme_unfocused_bg_color | Color | 
| GTK.theme_unfocused_base_color | Color | 
| GTK.theme_unfocused_selected_bg_color | Color | 
| GTK.theme_unfocused_selected_fg_color | Color | 
| GTK.insensitive_bg_color | Color | 
| GTK.insensitive_fg_color | Color | 
| GTK.insensitive_base_color | Color | 
| GTK.borders | Color | 
| GTK.unfocused_borders | Color | 
| GTK.warning_color | Color | 
| GTK.error_color | Color | 
| GTK.success_color | Color | 
- Since:
- 22
- 
Property SummaryPropertiesTypePropertyDescriptionThe 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.The color used for background regions.The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.The color used for foreground elements like text.
- 
Nested Class Summary
- 
Method SummaryModifier and TypeMethodDescriptionThe 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.The color used for background regions.The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.The color used for foreground elements like text.Gets the value of theaccentColorproperty.Gets the value of thebackgroundColorproperty.getBoolean(String key) Returns an optionalBooleanto which the specified key is mapped.Returns an optionalColorto which the specified key is mapped.Gets the value of thecolorSchemeproperty.Returns an optionalDoubleto which the specified key is mapped.Gets the value of theforegroundColorproperty.getInteger(String key) Returns an optionalIntegerto which the specified key is mapped.Returns an optionalStringto which the specified key is mapped.<T> Optional<T> Returns an optional value to which the specified key is mapped.Methods declared in interface java.util.Mapclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods declared in interface javafx.beans.ObservableaddListener, removeListener, subscribeMethods declared in interface javafx.collections.ObservableMapaddListener, removeListener
- 
Property Details- 
colorSchemeReadOnlyObjectProperty<ColorScheme> colorSchemePropertyThe 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 LIGHT.- Default value:
- ColorScheme.LIGHT
- See Also:
 
- 
backgroundColorReadOnlyObjectProperty<Color> backgroundColorPropertyThe color used for background regions.If the platform does not report a background color, this property defaults to WHITE.- Default value:
- Color.WHITE
- See Also:
 
- 
foregroundColorReadOnlyObjectProperty<Color> foregroundColorPropertyThe color used for foreground elements like text.If the platform does not report a foreground color, this property defaults to BLACK.- Default value:
- Color.BLACK
- See Also:
 
- 
accentColorReadOnlyObjectProperty<Color> accentColorPropertyThe 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 #157EFB).- Default value:
- #157EFB
- See Also:
 
 
- 
- 
Method Details- 
colorSchemePropertyReadOnlyObjectProperty<ColorScheme> colorSchemeProperty()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 LIGHT.- Default value:
- ColorScheme.LIGHT
- Returns:
- the colorSchemeproperty
- See Also:
 
- 
getColorSchemeColorScheme getColorScheme()Gets the value of thecolorSchemeproperty.- Property description:
- 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 LIGHT.
- Default value:
- ColorScheme.LIGHT
- Returns:
- the value of the colorSchemeproperty
- See Also:
 
- 
backgroundColorPropertyReadOnlyObjectProperty<Color> backgroundColorProperty()The color used for background regions.If the platform does not report a background color, this property defaults to WHITE.- Default value:
- Color.WHITE
- Returns:
- the backgroundColorproperty
- See Also:
 
- 
getBackgroundColorColor getBackgroundColor()Gets the value of thebackgroundColorproperty.- Property description:
- The color used for background regions.
 If the platform does not report a background color, this property defaults to WHITE.
- Default value:
- Color.WHITE
- Returns:
- the value of the backgroundColorproperty
- See Also:
 
- 
foregroundColorPropertyReadOnlyObjectProperty<Color> foregroundColorProperty()The color used for foreground elements like text.If the platform does not report a foreground color, this property defaults to BLACK.- Default value:
- Color.BLACK
- Returns:
- the foregroundColorproperty
- See Also:
 
- 
getForegroundColorColor getForegroundColor()Gets the value of theforegroundColorproperty.- Property description:
- The color used for foreground elements like text.
 If the platform does not report a foreground color, this property defaults to BLACK.
- Default value:
- Color.BLACK
- Returns:
- the value of the foregroundColorproperty
- See Also:
 
- 
accentColorPropertyReadOnlyObjectProperty<Color> accentColorProperty()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 #157EFB).- Default value:
- #157EFB
- Returns:
- the accentColorproperty
- See Also:
 
- 
getAccentColorColor getAccentColor()Gets the value of theaccentColorproperty.- Property description:
- 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 #157EFB).
- Default value:
- #157EFB
- Returns:
- the value of the accentColorproperty
- See Also:
 
- 
getIntegerReturns an optionalIntegerto which the specified key is mapped.- Parameters:
- key- the key
- Returns:
- the optional Integerto which the key is mapped
- Throws:
- NullPointerException- if- keyis null
- IllegalArgumentException- if the key is not mappable to an- Integer
 
- 
getDoubleReturns an optionalDoubleto which the specified key is mapped.- Parameters:
- key- the key
- Returns:
- the optional Doubleto which the key is mapped
- Throws:
- NullPointerException- if- keyis null
- IllegalArgumentException- if the key is not mappable to a- Double
 
- 
getBooleanReturns an optionalBooleanto which the specified key is mapped.- Parameters:
- key- the key
- Returns:
- the optional Booleanto which the key is mapped
- Throws:
- NullPointerException- if- keyis null
- IllegalArgumentException- if the key is not mappable to a- Boolean
 
- 
getStringReturns an optionalStringto which the specified key is mapped.- Parameters:
- key- the key
- Returns:
- the optional Stringto which the key is mapped
- Throws:
- NullPointerException- if- keyis null
- IllegalArgumentException- if the key is not mappable to a- String
 
- 
getColorReturns an optionalColorto which the specified key is mapped.- Parameters:
- key- the key
- Returns:
- the optional Colorinstance to which the key is mapped
- Throws:
- NullPointerException- if- keyis null
- IllegalArgumentException- if the key is not mappable to a- Color
 
- 
getValueReturns an optional value to which the specified key is mapped.- Type Parameters:
- T- the type of the value
- Parameters:
- key- the key
- type- the type of the value
- Returns:
- the optional value to which the key is mapped
- Throws:
- NullPointerException- if- keyor- typeis null
- IllegalArgumentException- if the key is not mappable to a value of type- T
 
 
-