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 and 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`.
    `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`.

    - #### getScreens

          public static ObservableList<Screen> getScreens()

      The 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`.
      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 @{code Screen}

    - #### 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.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.