public class Screen
extends java.lang.Object
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();
Constructor and Description |
---|
Screen() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.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 @{code 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. |
java.lang.String |
toString()
Returns a string representation of this
Screen object. |
public static Screen getPrimary()
Screen
.public static ObservableList<Screen> getScreens()
Screens
.public static ObservableList<Screen> getScreensForRectangle(double x, double y, double width, double height)
Screens
that intersects the provided rectangle.x
- the x coordinate of the upper-left corner of the specified
rectangular areay
- the y coordinate of the upper-left corner of the specified
rectangular areawidth
- the width of the specified rectangular areaheight
- the height of the specified rectangular areaScreens
for which Screen.bounds
intersects the provided rectanglepublic static ObservableList<Screen> getScreensForRectangle(Rectangle2D r)
Screens
that intersects the provided rectangle.r
- The specified Rectangle2D
Screens
for which Screen.bounds
intersects the provided rectanglepublic Rectangle2D getBounds()
Screen
.Screen
public final Rectangle2D getVisualBounds()
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
.Screen
public final double getDpi()
public int hashCode()
Screen
object.hashCode
in class java.lang.Object
Screen
object.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is equal to the obj
argument; false
otherwise.public java.lang.String toString()
Screen
object.toString
in class java.lang.Object
Screen
object.Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.