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.


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

    Android Configuration: none

    iOS Configuration: none

    • Method Detail

      • orientationProperty<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.
        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.
        An optional containing the orientation of the device, or empty if unknown