public final 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();
Modifier and Type | Field and Description |
---|---|
private static ScreenConfigurationAccessor |
accessor |
private Rectangle2D |
bounds
The bounds of this
Screen . |
private static java.util.concurrent.atomic.AtomicBoolean |
configurationDirty |
private double |
dpi
The resolution (dots per inch) of this
Screen . |
private static Screen |
primary |
private float |
renderScale
The scale factor of this
Screen . |
private static ObservableList<Screen> |
screens |
private static ObservableList<Screen> |
unmodifiableScreens |
private Rectangle2D |
visualBounds
The visual bounds of this
Screen . |
Modifier | Constructor and Description |
---|---|
private |
Screen() |
Modifier and Type | Method and Description |
---|---|
private static void |
checkDirty() |
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
Screen . |
static Screen |
getPrimary()
The primary
Screen . |
private float |
getRenderScale()
Gets the scale factor of this
Screen . |
(package private) static Screen |
getScreenForNative(java.lang.Object obj) |
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. |
private static Screen |
nativeToScreen(java.lang.Object obj,
Screen screen) |
java.lang.String |
toString()
Returns a string representation of this
Screen object. |
private static void |
updateConfiguration() |
private static final java.util.concurrent.atomic.AtomicBoolean configurationDirty
private static final ScreenConfigurationAccessor accessor
private static Screen primary
private static final ObservableList<Screen> screens
private static final ObservableList<Screen> unmodifiableScreens
private Rectangle2D bounds
Screen
.private Rectangle2D visualBounds
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
.private double dpi
Screen
.private float renderScale
Screen
.private static void checkDirty()
private static void updateConfiguration()
static Screen getScreenForNative(java.lang.Object obj)
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 final 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()
Screen
.private float getRenderScale()
Screen
.
E.g. on Retina displays on Mac the scale factor may be equal to 2.0.
On regular displays this method returns 1.0.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.