APIdia Launch Partner
Top Description Methods
com.sun.javafx.css.media

public sealed Interface MediaQueryContext

permits SceneContext
Known Direct Implementers
com.sun.javafx.scene.SceneContext
Imports
com.sun.javafx.scene.SceneContext, javafx.application.ColorScheme

A media query is evaluated against a MediaQueryContext, which provides the media feature values that can be referenced in a media query expression.

Method Summary

Modifier and TypeMethod and Description
public ColorScheme

Returns:

the color scheme
getColorScheme
()

Provides the value for the prefers-color-scheme media feature.

public double

Returns:

the height
getHeight
()

Provides the value for the height media feature.

public double

Returns:

the width
getWidth
()

Provides the value for the width media feature.

public boolean

Returns:

true if the application is in full-screen mode
isFullScreen
()

Provides the value for the display-mode media feature.

public boolean

Returns:

true if the application should use persistent scroll bars
isPersistentScrollBars
()

Provides the value for the -fx-prefers-persistent-scrollbars media feature.

public boolean

Returns:

true if the application should reduce internet traffic
isReducedData
()

Provides the value for the prefers-reduced-data media feature.

public boolean

Returns:

true if the application should reduce motion
isReducedMotion
()

Provides the value for the prefers-reduced-motion media feature.

public boolean

Returns:

true if the application should reduce transparency
isReducedTransparency
()

Provides the value for the prefers-reduced-transparency media feature.

public void
notifyQueryEvaluated(MediaQuery
the query
query
,
boolean
the query value
currentValue
)

Notifies the media query context that a query has been evaluated and provides its current value.

Method Detail

getColorSchemeback to summary
public ColorScheme getColorScheme()

Provides the value for the prefers-color-scheme media feature.

Returns:ColorScheme

the color scheme

getHeightback to summary
public double getHeight()

Provides the value for the height media feature.

Returns:double

the height

getWidthback to summary
public double getWidth()

Provides the value for the width media feature.

Returns:double

the width

isFullScreenback to summary
public boolean isFullScreen()

Provides the value for the display-mode media feature.

Returns:boolean

true if the application is in full-screen mode

isPersistentScrollBarsback to summary
public boolean isPersistentScrollBars()

Provides the value for the -fx-prefers-persistent-scrollbars media feature.

Returns:boolean

true if the application should use persistent scroll bars

isReducedDataback to summary
public boolean isReducedData()

Provides the value for the prefers-reduced-data media feature.

Returns:boolean

true if the application should reduce internet traffic

isReducedMotionback to summary
public boolean isReducedMotion()

Provides the value for the prefers-reduced-motion media feature.

Returns:boolean

true if the application should reduce motion

isReducedTransparencyback to summary
public boolean isReducedTransparency()

Provides the value for the prefers-reduced-transparency media feature.

Returns:boolean

true if the application should reduce transparency

notifyQueryEvaluatedback to summary
public void notifyQueryEvaluated(MediaQuery query, boolean currentValue)

Notifies the media query context that a query has been evaluated and provides its current value.

The context can then re-evaluate the query at its own discretion and compare the evaluated value with the stored value to determine if it is necessary to re-apply CSS. This is an optimization to minimize CSS invalidation. For example, range-based queries like "width" and "height" can change very often when the scene is resized (but the evaluated value doesn't change often in a query like "width < 500"). If not for this optimization, we would have to speculatively re-apply CSS on every resize just to catch the case when a range-based query changes its value.

Parameters
query:MediaQuery

the query

currentValue:boolean

the query value