Top Description Fields Constructors Methods
javafx.stage

public final Class Screen

extends Object
Class Inheritance
Imports
java.util.List, java.util.concurrent.atomic.AtomicBoolean, javafx.collections.FXCollections, .ObservableList, javafx.geometry.Rectangle2D, com.sun.javafx.tk.ScreenConfigurationAccessor, .Toolkit

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

Field Summary

Modifier and TypeField and Description
private static final ScreenConfigurationAccessor
private Rectangle2D
bounds

The bounds of this Screen.

private static final AtomicBoolean
private double
dpi

The resolution (dots per inch) of this Screen.

private float
outputScaleX

The recommended output scale factor of this Screen in the X direction.

private float
outputScaleY

The recommended output scale factor of this Screen in the Y direction.

private static Screen
private static final ObservableList<Screen>
private static final ObservableList<Screen>
private Rectangle2D
visualBounds

The visual bounds of this Screen.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
public boolean

Returns:

true if this object is equal to the obj argument; false otherwise.
equals
(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public final Rectangle2D

Returns:

The bounds of this Screen
getBounds
()

Gets the bounds of this Screen.

public final double

Returns:

The resolution of this Screen
getDpi
()

Gets the resolution (dots per inch) of this Screen.

public final double

Returns:

the recommended output scale factor for the screen.
getOutputScaleX
()

Gets the recommended output scale factor of this Screen in the horizontal (X) direction.

public final double

Returns:

the recommended output scale factor for the screen.
getOutputScaleY
()

Gets the recommended output scale factor of this Screen in the vertical (Y) direction.

public static Screen

Returns:

the primary screen
getPrimary
()

The primary Screen.

pack-priv static Screen
public static ObservableList<Screen>

Returns:

observable list of currently available screens
getScreens
()

The observable list of currently available Screens.

public static ObservableList<Screen>

Returns:

a ObservableList of Screens for which Screen.bounds intersects the provided rectangle
getScreensForRectangle
(double
the x coordinate of the upper-left corner of the specified rectangular area
x
,
double
the y coordinate of the upper-left corner of the specified rectangular area
y
,
double
the width of the specified rectangular area
width
,
double
the height of the specified rectangular area
height
)

Returns a ObservableList of Screens that intersects the provided rectangle.

public static ObservableList<Screen>

Returns:

a ObservableList of Screens for which Screen.bounds intersects the provided rectangle
getScreensForRectangle
(Rectangle2D
The specified Rectangle2D
r
)

Returns a ObservableList of Screens that intersects the provided rectangle.

public final Rectangle2D

Returns:

The visual bounds of this Screen
getVisualBounds
()

Gets the visual bounds of this Screen.

public int

Returns:

a hash code for this Screen object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code for this Screen object.

private static Screen
public String

Returns:

a string representation of this Screen object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this Screen object.

private static void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

accessorback to summary
private static final ScreenConfigurationAccessor accessor
boundsback to summary
private Rectangle2D bounds

The bounds of this Screen.

configurationDirtyback to summary
private static final AtomicBoolean configurationDirty
dpiback to summary
private double dpi

The resolution (dots per inch) of this Screen.

outputScaleXback to summary
private float outputScaleX

The recommended output scale factor of this Screen in the X direction.

outputScaleYback to summary
private float outputScaleY

The recommended output scale factor of this Screen in the Y direction.

primaryback to summary
private static Screen primary
screensback to summary
private static final ObservableList<Screen> screens
unmodifiableScreensback to summary
private static final ObservableList<Screen> unmodifiableScreens
visualBoundsback to summary
private Rectangle2D visualBounds

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.

Constructor Detail

Screenback to summary
private Screen()

Method Detail

checkDirtyback to summary
private static void checkDirty()
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is equal to the obj argument; false otherwise.

Annotations
@Override
getBoundsback to summary
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:Rectangle2D

The bounds of this Screen

getDpiback to summary
public final double getDpi()

Gets the resolution (dots per inch) of this Screen.

Returns:double

The resolution of this Screen

getOutputScaleXback to summary
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:double

the recommended output scale factor for the screen.

Since
9
getOutputScaleYback to summary
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:double

the recommended output scale factor for the screen.

Since
9
getPrimaryback to summary
public static Screen getPrimary()

The primary Screen.

Returns:Screen

the primary screen

getScreenForNativeback to summary
pack-priv static Screen getScreenForNative(Object obj)
getScreensback to summary
public static ObservableList<Screen> getScreens()

The observable list of currently available Screens.

Returns:ObservableList<Screen>

observable list of currently available screens

getScreensForRectangleback to summary
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:double

the x coordinate of the upper-left corner of the specified rectangular area

y:double

the y coordinate of the upper-left corner of the specified rectangular area

width:double

the width of the specified rectangular area

height:double

the height of the specified rectangular area

Returns:ObservableList<Screen>

a ObservableList of Screens for which Screen.bounds intersects the provided rectangle

getScreensForRectangleback to summary
public static ObservableList<Screen> getScreensForRectangle(Rectangle2D r)

Returns a ObservableList of Screens that intersects the provided rectangle.

Parameters
r:Rectangle2D

The specified Rectangle2D

Returns:ObservableList<Screen>

a ObservableList of Screens for which Screen.bounds intersects the provided rectangle

getVisualBoundsback to summary
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:Rectangle2D

The visual bounds of this Screen

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this Screen object.

Returns:int

a hash code for this Screen object.

Annotations
@Override
nativeToScreenback to summary
private static Screen nativeToScreen(Object obj, Screen screen)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this Screen object.

Returns:String

a string representation of this Screen object.

Annotations
@Override
updateConfigurationback to summary
private static void updateConfiguration()