-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
A well-designed dark mode integration requires a JavaFX application to not only provide a set of suitable dark stylesheets, but also configure the platform window decorations to reflect the dark theme. This requires a new API to control the appearance of window decorations:
public class Stage {
...
public ObjectProperty<Appearance> appearanceProperty();
public Appearance getAppearance();
public void setAppearance(Appearance appearance);
...
}
By default, a JavaFX stage uses a light appearance. Developers can set the stage appearance to either light or dark independently from the operating system's dark mode setting. This can be useful for applications that only offer either a light or a dark theme.
Applications that support both appearances and want to reflect the OS preference can do so by simply binding the stage appearance to the platform appearance:
var stage = new Stage();
stage.appearanceProperty().bind(
Platform.getPreferences().appearanceProperty());
stage.setScene(...);
stage.show();
public class Stage {
...
public ObjectProperty<Appearance> appearanceProperty();
public Appearance getAppearance();
public void setAppearance(Appearance appearance);
...
}
By default, a JavaFX stage uses a light appearance. Developers can set the stage appearance to either light or dark independently from the operating system's dark mode setting. This can be useful for applications that only offer either a light or a dark theme.
Applications that support both appearances and want to reflect the OS preference can do so by simply binding the stage appearance to the platform appearance:
var stage = new Stage();
stage.appearanceProperty().bind(
Platform.getPreferences().appearanceProperty());
stage.setScene(...);
stage.show();
- is blocked by
-
JDK-8301302 Platform preferences API
- Resolved