Interface OrientationService

All Known Implementing Classes:
AndroidOrientationService, DummyOrientationService, IOSOrientationService

public interface OrientationService
With the orientation service you can detect whether the device is currently oriented horizontally or vertically.

The OrientationService provides a read-only orientation property that will be updated when the orientation of the device changes. A user of the OrientationService can listen to changes of the orientation by registering a ChangeListener to the orientation property.

Example

 OrientationService.create().ifPresent(service -> {
      Orientation orientation = service.getOrientation();
      System.out.println("Current orientation: " + orientation.name());
  });

Android Configuration: none

iOS Configuration: none

Since:
3.0.0
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation>
    A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an instance of OrientationService.
    Optional<javafx.geometry.Orientation>
    Returns the current orientation of the device.
    javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation>
    A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.
  • Property Details

    • orientation

      javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation> orientationProperty
      A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.
      See Also:
  • Method Details

    • create

      static Optional<OrientationService> create()
      Returns an instance of OrientationService.
      Returns:
      An instance of OrientationService.
    • orientationProperty

      javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Orientation> orientationProperty()
      A read-only property containing the current orientation of the device, which will be updated automatically whenever the device orientation changes.
      See Also:
    • getOrientation

      Optional<javafx.geometry.Orientation> getOrientation()
      Returns the current orientation of the device.
      Returns:
      An optional containing the orientation of the device, or empty if unknown