Top Description Fields Constructors Methods
com.jogamp.newt

public abstract Class Screen

extends Object
Class Inheritance
Known Direct Subclasses
jogamp.newt.ScreenImpl
Imports
com.jogamp.newt.event.MonitorModeListener, jogamp.newt.Debug, java.lang.ref.WeakReference, java.util.ArrayList, .Collection, .List, com.jogamp.nativewindow.AbstractGraphicsScreen, .NativeWindowException, com.jogamp.nativewindow.util.Rectangle, .RectangleImmutable

A screen may span multiple MonitorDevices representing their combined virtual size.

All values of this interface are represented in pixel units, if not stated otherwise.

Coordinate System

Field Summary

Modifier and TypeField and Description
public static final boolean
public static final int
SCREEN_MODE_CHANGE_TIMEOUT

A 10s timeout for screen mode change.

protected static final ArrayList<WeakReference<Screen>>
protected static int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
public abstract int

Returns:

number of references post operation
addReference
()

See Display#addReference()

protected static void
addScreen2List(final Screen screen)

public abstract void
createNative()

Manual trigger the native creation, if not done yet..

public abstract void
destroy()

Manually trigger the destruction, incl.

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

return true if obj is of type Display and both FQN getFQName() equals
public static int
public static Collection<Screen>
getAllScreens()

Returns the global screen collection

public abstract Display

Returns:

the associated Display
getDisplay
()

public static Screen
getFirstScreenOf(final Display display, final int idx, final int
start index, then increasing until found or end of list *
fromIndex
)

public abstract String

Returns:

The screen fully qualified Screen name, which is a key of com.jogamp.newt.Display#getFQName() + getIndex().
getFQName
()

public abstract AbstractGraphicsScreen
public abstract int

Returns:

the rotated virtual viewport's height in pixel units.
getHeight
()

public abstract int

Returns:

this Screen index of all Screens of getDisplay().
getIndex
()

public static Screen
getLastScreenOf(final Display display, final int idx, final int
start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
fromIndex
)

public final MonitorDevice
getMainMonitor(final RectangleImmutable
arbitrary rectangle in window units
r
)

Returns the MonitorDevice with the highest viewport coverage of the given rectangle in window units, which is not a clone.

public final MonitorDevice
getMonitor(final int monitorId)

public abstract List<MonitorDevice>
getMonitorDevices()

Return a list of available MonitorDevices.

public abstract List<MonitorMode>
getMonitorModes()

Return a list of all MonitorModes for all MonitorDevices.

public abstract MonitorDevice
getPrimaryMonitor()

Returns the windowing manager's primary MonitorDevice, which holds the system menu bar, etc.

public abstract int

Returns:

number of references
getReferenceCount
()

private static Screen
getScreenOfImpl(final Display display, final int idx, final int fromIndex, final int incr)

public abstract RectangleImmutable

Returns:

the rotated virtual viewport, i.e. top-left origin and size, in pixel units.
getViewport
()

See Coordinate System.

public abstract RectangleImmutable

Returns:

the rotated virtual viewport, i.e. top-left origin and size, in window units.
getViewportInWindowUnits
()

See Coordinate System.

public abstract int

Returns:

the rotated virtual viewport's width in pixel units.
getWidth
()

public abstract int

Returns:

the x position of the virtual viewport's top-left origin in pixel units.
getX
()

See Coordinate System.

public abstract int

Returns:

the y position of the virtual viewport's top-left origin in pixel units.
getY
()

See Coordinate System.

public abstract int
hashCode()

Overrides java.lang.Object.hashCode.

return precomputed hashCode from FQN getFQName()
public abstract boolean
public abstract void
public abstract int

Returns:

number of references post operation
removeReference
()

See Display#removeReference()

public final void
unionOfMonitorViewports(final Rectangle
storage for result in pixel units, maybe null
viewport
,
final Rectangle
storage for result in window units, maybe null
viewportInWindowUnits
)

Calculates the union of all monitor's viewport in pixel- and window units.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
public static final boolean DEBUG
SCREEN_MODE_CHANGE_TIMEOUTback to summary
public static final int SCREEN_MODE_CHANGE_TIMEOUT

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

screenListback to summary
protected static final ArrayList<WeakReference<Screen>> screenList
screensActiveback to summary
protected static int screensActive

Constructor Detail

Screenback to summary
public Screen()

Method Detail

addMonitorModeListenerback to summary
public abstract void addMonitorModeListener(MonitorModeListener sml)
Parameters
sml:MonitorModeListener

MonitorModeListener to be added for MonitorEvent

addReferenceback to summary
public abstract int addReference() throws NativeWindowException

See Display#addReference()

Returns:int

number of references post operation

Exceptions
NativeWindowException:
if the native creation failed.
See Also
removeReference(), setDestroyWhenUnused(boolean), getDestroyWhenUnused()
addScreen2Listback to summary
protected static void addScreen2List(final Screen screen)
createNativeback to summary
public abstract void createNative() throws NativeWindowException

Manual trigger the native creation, if not done yet..
This is useful to be able to request the com.jogamp.nativewindow.AbstractGraphicsScreen, via getGraphicsScreen().
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 issue Display#createNative() if the reference count was 0.

Exceptions
NativeWindowException:
if the native creation failed.
destroyback to summary
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 issue Display#destroy() if the reference count becomes 0.

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

return true if obj is of type Display and both FQN getFQName() equals

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getActiveScreenNumberback to summary
public static int getActiveScreenNumber()
getAllScreensback to summary
public static Collection<Screen> getAllScreens()

Returns the global screen collection

getDisplayback to summary
public abstract Display getDisplay()
Returns:Display

the associated Display

getFirstScreenOfback to summary
public static Screen getFirstScreenOf(final Display display, final int idx, final int fromIndex)
Parameters
fromIndex:int

start index, then increasing until found or end of list *

getFQNameback to summary
public abstract String getFQName()
Returns:String

The screen fully qualified Screen name, which is a key of com.jogamp.newt.Display#getFQName() + getIndex().

getGraphicsScreenback to summary
public abstract AbstractGraphicsScreen getGraphicsScreen()
getHeightback to summary
public abstract int getHeight()
Returns:int

the rotated virtual viewport's height in pixel units.

getIndexback to summary
public abstract int getIndex()
Returns:int

this Screen index of all Screens of getDisplay().

getLastScreenOfback to summary
public static Screen getLastScreenOf(final Display display, final int idx, final int fromIndex)
Parameters
fromIndex:int

start index, then decreasing until found or end of list. -1 is interpreted as size - 1.

getMainMonitorback to summary
public final MonitorDevice getMainMonitor(final RectangleImmutable r)

Returns the MonitorDevice with the highest viewport coverage of the given rectangle in window units, which is not a clone.

If no coverage is detected the first MonitorDevice is returned.

Parameters
r:RectangleImmutable

arbitrary rectangle in window units

getMonitorback to summary
public final MonitorDevice getMonitor(final int monitorId)
getMonitorDevicesback to summary
public abstract List<MonitorDevice> getMonitorDevices()

Return a list of available MonitorDevices.

getMonitorModesback to summary
public abstract List<MonitorMode> getMonitorModes()

Return a list of all MonitorModes for all MonitorDevices.

The list is ordered in descending order, see MonitorMode#compareTo(MonitorMode).

getPrimaryMonitorback to summary
public abstract MonitorDevice getPrimaryMonitor()

Returns the windowing manager's primary MonitorDevice, which holds the system menu bar, etc.

See Also
MonitorDevice#isPrimary()
getReferenceCountback to summary
public abstract int getReferenceCount()
Returns:int

number of references

getScreenOfImplback to summary
private static Screen getScreenOfImpl(final Display display, final int idx, final int fromIndex, final int incr)
getViewportback to summary
public abstract RectangleImmutable getViewport()

See Coordinate System.

Returns:RectangleImmutable

the rotated virtual viewport, i.e. top-left origin and size, in pixel units.

See Also
getViewportInWindowUnits()
getViewportInWindowUnitsback to summary
public abstract RectangleImmutable getViewportInWindowUnits()

See Coordinate System.

Returns:RectangleImmutable

the rotated virtual viewport, i.e. top-left origin and size, in window units.

See Also
getViewport()
getWidthback to summary
public abstract int getWidth()
Returns:int

the rotated virtual viewport's width in pixel units.

getXback to summary
public abstract int getX()

See Coordinate System.

Returns:int

the x position of the virtual viewport's top-left origin in pixel units.

getYback to summary
public abstract int getY()

See Coordinate System.

Returns:int

the y position of the virtual viewport's top-left origin in pixel units.

hashCodeback to summary
public abstract int hashCode()

Overrides java.lang.Object.hashCode.

return precomputed hashCode from FQN getFQName()

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
isNativeValidback to summary
public abstract boolean isNativeValid()
removeMonitorModeListenerback to summary
public abstract void removeMonitorModeListener(MonitorModeListener sml)
Parameters
sml:MonitorModeListener

MonitorModeListener to be removed from MonitorEvent

removeReferenceback to summary
public abstract int removeReference()

See Display#removeReference()

Returns:int

number of references post operation

See Also
addReference(), setDestroyWhenUnused(boolean), getDestroyWhenUnused()
unionOfMonitorViewportsback to summary
public final void unionOfMonitorViewports(final Rectangle viewport, final Rectangle viewportInWindowUnits)

Calculates the union of all monitor's viewport in pixel- and window units.

Should be equal to getX(), getY(), getWidth() and getHeight(), however, some native toolkits may choose a different virtual screen area.

Parameters
viewport:Rectangle

storage for result in pixel units, maybe null

viewportInWindowUnits:Rectangle

storage for result in window units, maybe null