public interface DisplayService
Example
Services.get(DisplayService.class).ifPresent(service -> {
Dimension2D resolution = service.getScreenResolution();
System.out.printf("Screen resolution: %.0fx%.0f", resolution.getWidth(), resolution.getHeight());
});
Android Configuration: none
iOS Configuration: none
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyObjectProperty<DisplayService.Notch> |
notch
Property that contains the position of the notch, if any, and can be used
to track changes in its location.
|
Modifier and Type | Interface and Description |
---|---|
static class |
DisplayService.Notch
Possible Notch positions
|
Modifier and Type | Method and Description |
---|---|
javafx.geometry.Dimension2D |
getDefaultDimensions()
Returns the default screen dimensions of a mobile device, in density
independent pixel units.
|
javafx.geometry.Dimension2D |
getScreenResolution()
Returns the screen resolution of the device, in pixels.
|
float |
getScreenScale()
Returns the logical density of the display
|
boolean |
hasNotch()
Indicates if the device has a notch that modifies the display or not.
|
boolean |
isDesktop()
Returns true if the device is considered a desktop / laptop.
|
boolean |
isPhone()
Returns true if the device is considered a phone.
|
boolean |
isScreenRound()
Returns true if the device has a round screen
|
boolean |
isTablet()
Returns true if the device is considered a tablet.
|
javafx.beans.property.ReadOnlyObjectProperty<DisplayService.Notch> |
notchProperty()
Property that contains the position of the notch, if any, and can be used
to track changes in its location.
|
javafx.beans.property.ReadOnlyObjectProperty<DisplayService.Notch> notchProperty
boolean isPhone()
boolean isTablet()
charm-desktop-form
is set to tablet
, it will return true. False otherwiseboolean isDesktop()
javafx.geometry.Dimension2D getScreenResolution()
javafx.geometry.Dimension2D getDefaultDimensions()
float getScreenScale()
boolean isScreenRound()
boolean hasNotch()
javafx.beans.property.ReadOnlyObjectProperty<DisplayService.Notch> notchProperty()