Class Screen
MonitorDevice
s representing their combined virtual size.
All values of this interface are represented in pixel units, if not stated otherwise.
Coordinate System
- Screen space has it's origin in the top-left corner, and may not be at 0/0.
Virtual viewport
covers allMonitorDevice
sviewports
and has it's origin in the top-left corner, and may not be at 0/0.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
static final int
A 10s timeout for screen mode change. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
abstract int
abstract void
Manual trigger the native creation, if not done yet..
This is useful to be able to request theAbstractGraphicsScreen
, viagetGraphicsScreen()
.
Otherwise the abstract device won't be available before the dependent component (Window) is realized.abstract void
destroy()
Manually trigger the destruction, incl.boolean
return true if obj is of type Display and both FQNgetFQName()
equalsstatic int
static Collection<Screen>
Returns the global screen collectionabstract Display
static Screen
getFirstScreenOf
(Display display, int idx, int fromIndex) abstract String
abstract AbstractGraphicsScreen
abstract int
abstract int
getIndex()
static Screen
getLastScreenOf
(Display display, int idx, int fromIndex) final MonitorDevice
Returns theMonitorDevice
with the highestviewport
coverage
of the given rectangle in window units, which is not aclone
.final MonitorDevice
getMonitor
(int monitorId) abstract List<MonitorDevice>
Return a list of availableMonitorDevice
s.abstract List<MonitorMode>
Return a list of allMonitorMode
s for allMonitorDevice
s.abstract MonitorDevice
Returns the windowing manager's primaryMonitorDevice
, which holds the system menu bar, etc.abstract int
abstract RectangleImmutable
See Coordinate System.abstract RectangleImmutable
See Coordinate System.abstract int
getWidth()
abstract int
getX()
See Coordinate System.abstract int
getY()
See Coordinate System.abstract int
hashCode()
return precomputed hashCode from FQNgetFQName()
abstract boolean
abstract void
abstract int
final void
unionOfMonitorViewports
(Rectangle viewport, Rectangle viewportInWindowUnits) Calculates the union of all monitor'sviewport
in pixel- and window units.
-
Field Details
-
SCREEN_MODE_CHANGE_TIMEOUT
public static final int SCREEN_MODE_CHANGE_TIMEOUTA 10s timeout for screen mode change. It is observed, that some platforms need a notable amount of time for this task, especially in case of rotation change.- See Also:
-
DEBUG
public static final boolean DEBUG
-
-
Constructor Details
-
Screen
public Screen()
-
-
Method Details
-
hashCode
public abstract int hashCode()return precomputed hashCode from FQNgetFQName()
-
equals
return true if obj is of type Display and both FQNgetFQName()
equals -
createNative
Manual trigger the native creation, if not done yet..
This is useful to be able to request theAbstractGraphicsScreen
, viagetGraphicsScreen()
.
Otherwise the abstract device won't be available before the dependent component (Window) is realized.This method is usually invoke by
addReference()
This method invokes
Display.addReference()
after creating the native peer,
which will issueDisplay.createNative()
if the reference count was 0.- Throws:
NativeWindowException
- if the native creation failed.
-
destroy
public abstract void destroy()Manually trigger the destruction, incl. native destruction.
This method is usually invoke by
removeReference()
This method invokes
Display.removeReference()
after it's own destruction,
which will issueDisplay.destroy()
if the reference count becomes 0. -
isNativeValid
public abstract boolean isNativeValid() -
getReferenceCount
public abstract int getReferenceCount()- Returns:
- number of references
-
addReference
- Returns:
- number of references post operation
- Throws:
NativeWindowException
- if the native creation failed.- See Also:
-
removeReference()
#setDestroyWhenUnused(boolean)
#getDestroyWhenUnused()
-
removeReference
public abstract int removeReference()- Returns:
- number of references post operation
- See Also:
-
addReference()
#setDestroyWhenUnused(boolean)
#getDestroyWhenUnused()
-
getGraphicsScreen
-
getIndex
public abstract int getIndex()- Returns:
- this Screen index of all Screens of
getDisplay()
.
-
getX
public abstract int getX()See Coordinate System.- Returns:
- the x position of the virtual viewport's top-left origin in pixel units.
-
getY
public abstract int getY()See Coordinate System.- Returns:
- the y position of the virtual viewport's top-left origin in pixel units.
-
getWidth
public abstract int getWidth()- Returns:
- the rotated virtual viewport's width in pixel units.
-
getHeight
public abstract int getHeight()- Returns:
- the rotated virtual viewport's height in pixel units.
-
getViewport
See Coordinate System.- Returns:
- the rotated virtual viewport, i.e. top-left origin and size, in pixel units.
- See Also:
-
getViewportInWindowUnits
See Coordinate System.- Returns:
- the rotated virtual viewport, i.e. top-left origin and size, in window units.
- See Also:
-
getDisplay
- Returns:
- the associated Display
-
getFQName
- Returns:
- The screen fully qualified Screen name,
which is a key of
Display.getFQName()
+getIndex()
.
-
getMonitorModes
Return a list of allMonitorMode
s for allMonitorDevice
s.The list is ordered in descending order, see
MonitorMode.compareTo(MonitorMode)
. -
getMonitorDevices
Return a list of availableMonitorDevice
s. -
getPrimaryMonitor
Returns the windowing manager's primaryMonitorDevice
, which holds the system menu bar, etc.- See Also:
-
getMainMonitor
Returns theMonitorDevice
with the highestviewport
coverage
of the given rectangle in window units, which is not aclone
.If no coverage is detected the first
MonitorDevice
is returned.- Parameters:
r
- arbitrary rectangle in window units
-
getMonitor
-
unionOfMonitorViewports
Calculates the union of all monitor'sviewport
in pixel- and window units.Should be equal to
getX()
,getY()
,getWidth()
andgetHeight()
, however, some native toolkits may choose a different virtual screen area.- Parameters:
viewport
- storage for result in pixel units, maybe nullviewportInWindowUnits
- storage for result in window units, maybe null
-
addMonitorModeListener
- Parameters:
sml
-MonitorModeListener
to be added forMonitorEvent
-
removeMonitorModeListener
- Parameters:
sml
-MonitorModeListener
to be removed fromMonitorEvent
-
getFirstScreenOf
- Parameters:
type
-name
-fromIndex
- start index, then increasing until found or end of list *- Returns:
-
getLastScreenOf
- Parameters:
type
-name
-fromIndex
- start index, then decreasing until found or end of list. -1 is interpreted as size - 1.- Returns:
-
getAllScreens
Returns the global screen collection -
getActiveScreenNumber
public static int getActiveScreenNumber()
-