Module javafx.graphics
Package javafx.stage

## Class Screen

- java.lang.Object
- - javafx.stage.Screen

-     public final class Screen
      extends Object

  Describes the characteristics of a graphics destination such as monitor. In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices, the bounds of the `Screen` objects are relative to the `Screen.primary`.

  For example:

       Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();

       //set Stage boundaries to visible bounds of the main screen
       stage.setX(primaryScreenBounds.getMinX());
       stage.setY(primaryScreenBounds.getMinY());
       stage.setWidth(primaryScreenBounds.getWidth());
       stage.setHeight(primaryScreenBounds.getHeight());

       stage.show();

  Since:
    JavaFX 2.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` | Indicates whether some other object is "equal to" this one.
    `Rectangle2D` | `getBounds()` | Gets the bounds of this `Screen`.
    `double` | `getDpi()` | Gets the resolution (dots per inch) of this `Screen`.
    `double` | `getOutputScaleX()` | Gets the recommended output scale factor of this `Screen` in the horizontal (`X`) direction.
    `double` | `getOutputScaleY()` | Gets the recommended output scale factor of this `Screen` in the vertical (`Y`) direction.
    `static Screen` | `getPrimary()` | The primary `Screen`.
    `static ObservableList<Screen>` | `getScreens()` | The observable list of currently available `Screens`.
    `static ObservableList<Screen>` | `getScreensForRectangle​(double x, double y, double width, double height)` | Returns a ObservableList of `Screens` that intersects the provided rectangle.
    `static ObservableList<Screen>` | `getScreensForRectangle​(Rectangle2D r)` | Returns a ObservableList of `Screens` that intersects the provided rectangle.
    `Rectangle2D` | `getVisualBounds()` | Gets the visual bounds of this `Screen`.
    `int` | `hashCode()` | Returns a hash code for this `Screen` object.
    `String` | `toString()` | Returns a string representation of this `Screen` object.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getPrimary

          public static Screen getPrimary()

      The primary `Screen`.
      Returns:
        the primary screen

    - #### getScreens

          public static ObservableList<Screen> getScreens()

      The observable list of currently available `Screens`.
      Returns:
        observable list of currently available screens

    - #### getScreensForRectangle

          public static ObservableList<Screen> getScreensForRectangle​(double x,
                                                                      double y,
                                                                      double width,
                                                                      double height)

      Returns a ObservableList of `Screens` that intersects the provided rectangle.
      Parameters:
        `x` - the x coordinate of the upper-left corner of the specified rectangular area
        `y` - the y coordinate of the upper-left corner of the specified rectangular area
        `width` - the width of the specified rectangular area
        `height` - the height of the specified rectangular area
      Returns:
        a ObservableList of `Screens` for which `Screen.bounds` intersects the provided rectangle

    - #### getScreensForRectangle

          public static ObservableList<Screen> getScreensForRectangle​(Rectangle2D r)

      Returns a ObservableList of `Screens` that intersects the provided rectangle.
      Parameters:
        `r` - The specified `Rectangle2D`
      Returns:
        a ObservableList of `Screens` for which `Screen.bounds` intersects the provided rectangle

    - #### getBounds

          public final Rectangle2D getBounds()

      Gets the bounds of this `Screen`. The bounds will be reported adjusted for the `outputScale` so that resizing a `Window` with these bounds and the same `outputScale` as this `Screen` will cover the entire screen.
      Returns:
        The bounds of this `Screen`

    - #### getVisualBounds

          public final Rectangle2D getVisualBounds()

      Gets the visual bounds of this `Screen`. These bounds account for objects in the native windowing system such as task bars and menu bars. These bounds are contained by `Screen.bounds`.
      Returns:
        The visual bounds of this `Screen`

    - #### getDpi

          public final double getDpi()

      Gets the resolution (dots per inch) of this `Screen`.
      Returns:
        The resolution of this `Screen`

    - #### getOutputScaleX

          public final double getOutputScaleX()

      Gets the recommended output scale factor of this `Screen` in the horizontal (`X`) direction. This scale factor should be applied to a scene in order to compensate for the resolution and viewing distance of the output device. The visual bounds will be reported relative to this scale factor.
      Returns:
        the recommended output scale factor for the screen.
      Since:
        9

    - #### getOutputScaleY

          public final double getOutputScaleY()

      Gets the recommended output scale factor of this `Screen` in the vertical (`Y`) direction. This scale factor will be applied to the scene in order to compensate for the resolution and viewing distance of the output device. The visual bounds will be reported relative to this scale factor.
      Returns:
        the recommended output scale factor for the screen.
      Since:
        9

    - #### hashCode

          public int hashCode()

      Returns a hash code for this `Screen` object.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        a hash code for this `Screen` object.

    - #### equals

          public boolean equals​(Object obj)

      Indicates whether some other object is "equal to" this one.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `obj` - the reference object with which to compare.
      Returns:
        `true` if this object is equal to the `obj` argument; `false` otherwise.

    - #### toString

          public String toString()

      Returns a string representation of this `Screen` object.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of this `Screen` object.