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
    • Method Detail

      • 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.
        Returns:
        A read-only property containing the current orientation of the device
      • getOrientation

        java.util.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