Top Inners Fields Constructors Methods
com.jogamp.nativewindow.awt

public abstract Class JAWTWindow

extends Object
implements NativeWindow, OffscreenLayerSurface, OffscreenLayerOption, ScalableSurface
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.ScalableSurface, com.jogamp.nativewindow.OffscreenLayerOption, com.jogamp.nativewindow.OffscreenLayerSurface, com.jogamp.nativewindow.NativeWindow, com.jogamp.nativewindow.NativeSurfaceHolder, com.jogamp.nativewindow.NativeSurface, com.jogamp.nativewindow.SurfaceUpdatedListener
Known Direct Subclasses
jogamp.nativewindow.jawt.macosx.MacOSXJAWTWindow, jogamp.nativewindow.jawt.windows.WindowsJAWTWindow, jogamp.nativewindow.jawt.x11.X11JAWTWindow
Imports
com.jogamp.common.ExceptionUtils, com.jogamp.common.os.Platform, com.jogamp.common.util.awt.AWTEDTExecutor, com.jogamp.common.util.locks.LockFactory, .RecursiveLock, com.jogamp.nativewindow.MutableGraphicsConfiguration, .AbstractGraphicsConfiguration, .AbstractGraphicsDevice, .CapabilitiesImmutable, .NativeSurface, .NativeWindow, .NativeWindowException, .OffscreenLayerOption, .OffscreenLayerSurface, .ScalableSurface, .SurfaceUpdatedListener, java.awt.Component, .Container, .Cursor, .EventQueue, .GraphicsConfiguration, java.awt.event.ComponentEvent, .ComponentListener, .HierarchyEvent, .HierarchyListener, java.applet.Applet, com.jogamp.nativewindow.util.Insets, .InsetsImmutable, .PixelRectangle, .Point, .PointImmutable, .Rectangle, .RectangleImmutable, jogamp.common.os.PlatformPropsImpl, jogamp.nativewindow.SurfaceScaleUtils, .SurfaceUpdatedHelper, jogamp.nativewindow.awt.AWTMisc, jogamp.nativewindow.jawt.JAWT, .JAWTUtil, .JAWT_Rectangle

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final AppContextInfo
private volatile AWTGraphicsConfiguration
protected Rectangle
protected final Component
protected static final boolean
private final Runnable
protected long
private long
private final float[]
private volatile boolean
protected Insets
private boolean
private boolean
private JAWT
private final JAWTWindow.JAWTComponentListener
private final float[]
private final float[]
private volatile long
private final Runnable
private final float[]
protected boolean
private final RecursiveLock
private final SurfaceUpdatedHelper

Constructor Summary

AccessConstructor and Description
protected
JAWTWindow(final Object comp, final AbstractGraphicsConfiguration config)

Constructed by jogamp.nativewindow.NativeWindowFactoryImpl#getNativeWindow(Object, AbstractGraphicsConfiguration) via this platform's specialization (X11, OSX, Windows, ..).

Method Summary

Modifier and TypeMethod and Description
public void
public void
addSurfaceUpdatedListener(final int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
final SurfaceUpdatedListener
The listener object to be inserted
l
)

Implements com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Inserts the given SurfaceUpdatedListener at the specified position in the list.
public final void
attachSurfaceLayer(final long layerHandle)

Implements com.jogamp.nativewindow.OffscreenLayerSurface.attachSurfaceLayer.

Attach the offscreen layer to this offscreen layer surface.
protected void
attachSurfaceLayerImpl(final long layerHandle)

public final int[]
convertToPixelUnits(final int[]
int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.
windowUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Converts the given window units into pixel units in place.
public final int[]
convertToWindowUnits(final int[]
int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.
pixelUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Converts the given pixel units into window units in place.
public void
destroy()

Implements com.jogamp.nativewindow.NativeWindow.destroy.

Destroys this window incl.
public final void
detachSurfaceLayer()

Implements com.jogamp.nativewindow.OffscreenLayerSurface.detachSurfaceLayer.

Detaches a previously attached offscreen layer from this offscreen layer surface.
protected void
detachSurfaceLayerImpl(final long layerHandle, final Runnable
Runnable to be called before native detachment
detachNotify
)

private void
protected void
protected abstract JAWT

Returns:

The JAWT instance reflecting offscreen layer support, etc.
fetchJAWTImpl
()

If JAWT offscreen layer is supported, implementation shall respect getShallUseOffscreenLayer() and may respect isApplet().

public final long
getAttachedSurfaceLayer()

Implements com.jogamp.nativewindow.OffscreenLayerSurface.getAttachedSurfaceLayer.

Returns the attached surface layer or null if none is attached.
public final Component
public final AWTGraphicsConfiguration
public final RectangleImmutable

Returns:

the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock
getBounds
()

public final float[]
getCurrentSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getCurrentSurfaceScale.

Returns the current pixel scale of the associated NativeSurface.
public final long
getDisplayHandle()

Implements com.jogamp.nativewindow.NativeSurface.getDisplayHandle.

Convenience: Get display handle from AbstractGraphicsConfiguration .
public final AbstractGraphicsConfiguration
getGraphicsConfiguration()

Implements com.jogamp.nativewindow.NativeSurface.getGraphicsConfiguration.

Returns the graphics configuration corresponding to this window.
public final int
getHeight()

Implements com.jogamp.nativewindow.NativeWindow.getHeight.

Returns the height of the client area excluding insets (window decorations) in window units.
public final InsetsImmutable
getInsets()

Implements com.jogamp.nativewindow.NativeWindow.getInsets.

Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.
public final JAWT
getJAWT()

Returns the underlying JAWT instance created @ lockSurface().

public Point
getLocationOnScreen(final Point
Optional Point storage. If not null, null, it is translated about the resulting screen position and returned.
storage
)

Implements com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Returns the window's top-left client-area position in the screen.
protected Point
protected abstract Point
public final RecursiveLock
getLock()

Implements com.jogamp.nativewindow.OffscreenLayerSurface.getLock.

Returns the recursive lock object of this surface, which synchronizes multithreaded access.
public final float[]
getMaximumSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getMaximumSurfaceScale.

Returns the maximum pixel scale of the associated NativeSurface.
public float[]
getMinimumSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getMinimumSurfaceScale.

Returns the minimum pixel scale of the associated NativeSurface.
public final NativeSurface
public final NativeWindow
protected final float

Returns:

the safe pixelScale value for x-direction, i.e. never negative or zero. Updated with lock.
getPixelScaleX
()

protected final float

Returns:

the safe pixelScale value for y-direction, i.e. never negative or zero. Updated with lock.
getPixelScaleY
()

public final float[]
getRequestedSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getRequestedSurfaceScale.

Returns the requested pixel scale of the associated NativeSurface.
public final int
getScreenIndex()

Implements com.jogamp.nativewindow.NativeSurface.getScreenIndex.

Convenience: Get display handle from AbstractGraphicsConfiguration .
public final boolean
public long
getSurfaceHandle()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.
public final int
getSurfaceHeight()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHeight.

Returns the height of the client area excluding insets (window decorations) in pixel units.
public final Thread
getSurfaceLockOwner()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceLockOwner.

Return the locking owner's Thread, or null if not locked.
public final int
getSurfaceWidth()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceWidth.

Returns the width of the client area excluding insets (window decorations) in pixel units.
private static String
public final int
getWidth()

Implements com.jogamp.nativewindow.NativeWindow.getWidth.

Returns the width of the client area excluding insets (window decorations) in window units.
public long
getWindowHandle()

Implements com.jogamp.nativewindow.NativeWindow.getWindowHandle.

Returns the window handle for this NativeWindow.
public final int
getX()

Implements com.jogamp.nativewindow.NativeWindow.getX.

Returns the x position of the top-left corner of the client area relative to it's parent in window units.
public final int
getY()

Implements com.jogamp.nativewindow.NativeWindow.getY.

Returns the current y position of the top-left corner of the client area relative to it's parent in window units.
public boolean
hasFocus()

Implements com.jogamp.nativewindow.NativeWindow.hasFocus.

Returns true if this native window owns the focus, otherwise false.
public final boolean
hasPixelScaleChanged()

Returns and clears the hasPixelScaleChanged flag, as set via lockSurface().

public final boolean
hideCursor()

Implements com.jogamp.nativewindow.OffscreenLayerSurface.hideCursor.

Optional method hiding the cursor in the corresponding on-screen surface/window, if exists.
private static String
id(final Object obj)

protected synchronized void
protected abstract void
public final boolean
isApplet()

Returns true if the AWT component is parented to an java.applet.Applet, otherwise false.

public final boolean
isOffscreenLayerSurfaceEnabled()

Implements com.jogamp.nativewindow.OffscreenLayerOption.isOffscreenLayerSurfaceEnabled.

Returns true if this instance uses an offscreen layer, otherwise false.
public final boolean
isSurfaceLayerAttached()

Implements com.jogamp.nativewindow.OffscreenLayerSurface.isSurfaceLayerAttached.

Returns true if a surface layer is attached, otherwise false.
public final boolean
isSurfaceLockedByOtherThread()

Implements com.jogamp.nativewindow.NativeSurface.isSurfaceLockedByOtherThread.

Query if surface is locked by another thread, i.e. not the current one.
protected StringBuilder
private String
private String
jawtStr2(final String sub)

private final void
layoutSurfaceLayerIfEnabled(final boolean visible)

protected void
layoutSurfaceLayerImpl(final long layerHandle, final boolean visible)

Layout the offscreen layer according to the implementing class's constraints.

public final int
lockSurface()

Implements com.jogamp.nativewindow.NativeSurface.lockSurface.

Lock the surface of this native window.
protected int
protected abstract int
public void
public final void
setAWTGraphicsConfiguration(final AWTGraphicsConfiguration config)

Set a new AWTGraphicsConfiguration instance, as required if upstream component's GraphicsConfiguration has been changed due to reconfiguration, e.g. moving to a different monitor or changed capabilities.

public final void
setChosenCapabilities(final CapabilitiesImmutable caps)

Implements com.jogamp.nativewindow.OffscreenLayerSurface.setChosenCapabilities.

Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings.
public final boolean
setCursor(final PixelRectangle
cursor pixels, maybe null for default cursor
pixelrect
,
final PointImmutable
maybe null for default cursor
hotSpot
)

Implements com.jogamp.nativewindow.OffscreenLayerSurface.setCursor.

Optional method setting cursor in the corresponding on-screen surface/window, if exists.
protected final boolean

Returns:

true if pixelScale has changed, otherwise false
setReqPixelScale
()

set requested pixelScale

public void
setShallUseOffscreenLayer(final boolean v)

Implements com.jogamp.nativewindow.OffscreenLayerOption.setShallUseOffscreenLayer.

Request an offscreen layer, if supported.
public boolean
setSurfaceScale(final float[]
requested surface pixel scale float[2] values for x- and y-direction.
pixelScale
)

Implements com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.
public boolean
surfaceSwap()

Implements com.jogamp.nativewindow.NativeSurface.surfaceSwap.

Provide a mechanism to utilize custom (pre-) swap surface code.
public void
surfaceUpdated(final Object
is the caller object who updated the surface, e.g. a JOGL GLDrawable.
updater
,
final NativeSurface
the updated NativeSurface
ns
,
final long
the time in ms, when the surface was updated
when
)

Implements com.jogamp.nativewindow.SurfaceUpdatedListener.surfaceUpdated.

Notification of a surface update event, eg.
protected static final String
toHexString(final long l)

protected static final String
toHexString(final int i)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public final void
unlockSurface()

Implements com.jogamp.nativewindow.NativeSurface.unlockSurface.

Unlock the surface of this native window Shall not modify the surface handle, see lockSurface()

The implementation shall also invoke AbstractGraphicsDevice#unlock() for the final unlock (recursive count zero).

protected abstract void
protected final boolean

Returns:

true if bounds or pixelScale has changed, otherwise false
updateLockedData
(final JAWT_Rectangle jawtBounds, final GraphicsConfiguration gc)

Updates bounds and pixelScale

protected final boolean
public final boolean

Returns:

true if values were updated, otherwise false.
updatePixelScale
(final GraphicsConfiguration gc, final boolean
if true, the hasPixelScaleChanged flag will be cleared
clearFlag
)

Updates the minimum and maximum pixel-scale values and returns true if they were updated.

public final boolean
updatePixelScale(final boolean clearFlag)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait