Top Description Inners Fields Constructors Methods
org.lwjgl.system.jawt

public Class JAWTFunctions

extends Object
Class Inheritance
Imports
javax.annotation.*, org.lwjgl.system.*, java.awt.Component, java.awt.Frame

Bindings to the AWT native interface (jawt.h).

The AWT native interface allows a native C or C++ application a means by which to access native structures in AWT. This is to facilitate moving legacy C and C++ applications to Java and to target the needs of the community who, at present, wish to do their own native rendering to canvases for performance reasons. Standard extensions such as Java3D also require a means to access the underlying native data structures of AWT.

AWT Native Drawing Surface (JAWT_DrawingSurface)

For each platform, there is a native drawing surface structure. This platform-specific structure can be found in jawt_md.h. See JAWTX11DrawingSurfaceInfo for the Linux platform, JAWTWin32DrawingSurfaceInfo for the Windows platform and MACOSX_USE_CALAYER for the OS X platform.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
JAWTFunctions.Functions

Contains the function pointers loaded from the jawt SharedLibrary.

Field Summary

Modifier and TypeField and Description
private static final SharedLibrary
public static final int
JAWT_LOCK_BOUNDS_CHANGED

Bitmask values returned by Lock().

public static final int
JAWT_LOCK_CLIP_CHANGED

Bitmask values returned by Lock().

public static final int
JAWT_LOCK_ERROR

Bitmask values returned by Lock().

public static final int
JAWT_LOCK_SURFACE_CHANGED

Bitmask values returned by Lock().

public static final int
JAWT_MACOSX_USE_CALAYER

When calling GetAWT with a JAWT version less than 1.7, you must pass this flag or you will not be able to get a valid drawing surface and GetAWT will return false.

public static final int
JAWT_VERSION_1_3

JAWT versions.

public static final int
JAWT_VERSION_1_4

JAWT versions.

public static final int
JAWT_VERSION_1_7

JAWT versions.

public static final int
JAWT_VERSION_9

JAWT versions.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static SharedLibrary
getLibrary()

Returns the jawt SharedLibrary.

public static java.awt.Frame
JAWT_CreateEmbeddedFrame(long
the native platform handle
platformInfo
,
long
the function address
__functionAddress
)

Creates a Frame placed in a native container.

public static void
JAWT_DrawingSurface_FreeDrawingSurfaceInfo(JAWTDrawingSurfaceInfo dsi, long
the function address
__functionAddress
)

Frees the drawing surface info.

public static JAWTDrawingSurfaceInfo

Returns:

NULL if an error has occurred.
JAWT_DrawingSurface_GetDrawingSurfaceInfo
(JAWTDrawingSurface
the JAWTDrawingSurface to free
ds
,
long
the function address
__functionAddress
)

Returns the drawing surface info.

public static int

Returns:

a bitmask with one or more of the following values:
JAWT_DrawingSurface_Lock
(JAWTDrawingSurface
the surface to lock
ds
,
long
the function address
__functionAddress
)

Locks the surface of the target component for native rendering.

public static void
JAWT_DrawingSurface_Unlock(JAWTDrawingSurface
the surface to unlock
ds
,
long
the function address
__functionAddress
)

Unlocks the drawing surface of the target component for native rendering.

public static void
JAWT_FreeDrawingSurface(JAWTDrawingSurface
the JAWTDrawingSurface to free
ds
,
long
the function address
__functionAddress
)

Frees the drawing surface allocated in GetDrawingSurface.

public static boolean

Returns:

JNI_FALSE if an error occurs
JAWT_GetAWT
(JAWT
the target JAWT struct
awt
)

Returns the AWT native structure.

public static java.awt.Component
JAWT_GetComponent(long
the native platform handle
platformInfo
,
long
the function address
__functionAddress
)

Returns a reference to a Component from a native platform handle.

public static JAWTDrawingSurface

Returns:

NULL if an error has occurred
JAWT_GetDrawingSurface
(Object
must be a Component (should be a Canvas or Window for native rendering)
target
,
long
the function address
__functionAddress
)

Returns a drawing surface from a target jobject.

public static void
JAWT_Lock(long
the function address
__functionAddress
)

Locks the entire AWT for synchronization purposes.

public static void
JAWT_SetBounds(java.awt.Frame
the embedded frame
embeddedFrame
,
int
the x coordinate
x
,
int
the y coordinate
y
,
int
the width
w
,
int
the height
h
,
long
the function address
__functionAddress
)

Moves and resizes the embedded frame.

public static void
JAWT_SynthesizeWindowActivation(java.awt.Frame
the embedded frame
embeddedFrame
,
boolean
if true activates the window; otherwise, deactivates the window
doActivate
,
long
the function address
__functionAddress
)

Synthesizes a native message to activate or deactivate an EmbeddedFrame window depending on the value of parameter doActivate.

public static void
JAWT_Unlock(long
the function address
__functionAddress
)

Unlocks the entire AWT for synchronization purposes.

public static native java.awt.Frame
nJAWT_CreateEmbeddedFrame(long platformInfo, long __functionAddress)

Unsafe version of: CreateEmbeddedFrame

public static void
nJAWT_DrawingSurface_FreeDrawingSurfaceInfo(long dsi, long __functionAddress)

Unsafe version of: DrawingSurface_FreeDrawingSurfaceInfo

public static long
nJAWT_DrawingSurface_GetDrawingSurfaceInfo(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_GetDrawingSurfaceInfo

public static int
nJAWT_DrawingSurface_Lock(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_Lock

public static void
nJAWT_DrawingSurface_Unlock(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_Unlock

public static void
nJAWT_FreeDrawingSurface(long ds, long __functionAddress)

Unsafe version of: FreeDrawingSurface

public static native boolean
nJAWT_GetAWT(long awt, long __functionAddress)

Unsafe version of: GetAWT

public static boolean
nJAWT_GetAWT(long awt)

Unsafe version of: GetAWT

public static native java.awt.Component
nJAWT_GetComponent(long platformInfo, long __functionAddress)

Unsafe version of: GetComponent

public static native long
nJAWT_GetDrawingSurface(Object target, long __functionAddress)

Unsafe version of: GetDrawingSurface

public static native void
nJAWT_Lock(long __functionAddress)

Unsafe version of: Lock

public static native void
nJAWT_SetBounds(java.awt.Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress)

Unsafe version of: SetBounds

public static native void
nJAWT_SynthesizeWindowActivation(java.awt.Frame embeddedFrame, boolean doActivate, long __functionAddress)

Unsafe version of: SynthesizeWindowActivation

public static native void
nJAWT_Unlock(long __functionAddress)

Unsafe version of: Unlock

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JAWTback to summary
private static final SharedLibrary JAWT
JAWT_LOCK_BOUNDS_CHANGEDback to summary
public static final int JAWT_LOCK_BOUNDS_CHANGED

Bitmask values returned by Lock().

JAWT_LOCK_CLIP_CHANGEDback to summary
public static final int JAWT_LOCK_CLIP_CHANGED

Bitmask values returned by Lock().

JAWT_LOCK_ERRORback to summary
public static final int JAWT_LOCK_ERROR

Bitmask values returned by Lock().

JAWT_LOCK_SURFACE_CHANGEDback to summary
public static final int JAWT_LOCK_SURFACE_CHANGED

Bitmask values returned by Lock().

JAWT_MACOSX_USE_CALAYERback to summary
public static final int JAWT_MACOSX_USE_CALAYER

When calling GetAWT with a JAWT version less than 1.7, you must pass this flag or you will not be able to get a valid drawing surface and GetAWT will return false. This is to maintain compatibility with applications that used the interface with Java 6 which had multiple rendering models. This flag is not necessary when JAWT version 1.7 or greater is used as this is the only supported rendering mode.

When the native Cocoa toolkit is in use, the pointer stored in JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the specified layer to be overlaid on the Component's rectangle. If the window the Component belongs to has a CALayer attached to it, this layer will be accessible via the windowLayer property.


@protocol JAWT_SurfaceLayers
    @property (readwrite, retain) CALayer *layer;
    @property (readonly) CALayer *windowLayer;
@end
JAWT_VERSION_1_3back to summary
public static final int JAWT_VERSION_1_3

JAWT versions.

JAWT_VERSION_1_4back to summary
public static final int JAWT_VERSION_1_4

JAWT versions.

JAWT_VERSION_1_7back to summary
public static final int JAWT_VERSION_1_7

JAWT versions.

JAWT_VERSION_9back to summary
public static final int JAWT_VERSION_9

JAWT versions.

Constructor Detail

JAWTFunctionsback to summary
protected JAWTFunctions()

Method Detail

getLibraryback to summary
public static SharedLibrary getLibrary()

Returns the jawt SharedLibrary.

JAWT_CreateEmbeddedFrameback to summary
public static java.awt.Frame JAWT_CreateEmbeddedFrame(long platformInfo, long __functionAddress)

Creates a Frame placed in a native container. Container is referenced by the native platform handle. For example on Windows this corresponds to an HWND. For other platforms, see the appropriate machine-dependent header file for a description. The reference returned by this function is a local reference that is only valid in this environment. This function returns a NULL reference if no frame could be created with matching platform information.

Parameters
platformInfo:long

the native platform handle

__functionAddress:long

the function address

Annotations
@Nullable
@NativeType:jobject
Since
Java 9
JAWT_DrawingSurface_FreeDrawingSurfaceInfoback to summary
public static void JAWT_DrawingSurface_FreeDrawingSurfaceInfo(JAWTDrawingSurfaceInfo dsi, long __functionAddress)

Frees the drawing surface info.

Parameters
dsi:JAWTDrawingSurfaceInfo

the JAWTDrawingSurfaceInfo to free

__functionAddress:long

the function address

JAWT_DrawingSurface_GetDrawingSurfaceInfoback to summary
public static JAWTDrawingSurfaceInfo JAWT_DrawingSurface_GetDrawingSurfaceInfo(JAWTDrawingSurface ds, long __functionAddress)

Returns the drawing surface info.

The value returned may be cached, but the values may change if additional calls to DrawingSurface_Lock or DrawingSurface_Unlock are made. DrawingSurface_Lock must be called before this can return a valid value.

When finished with the returned value, DrawingSurface_FreeDrawingSurfaceInfo must be called.

Parameters
ds:JAWTDrawingSurface

the JAWTDrawingSurface to free

__functionAddress:long

the function address

Returns:JAWTDrawingSurfaceInfo

NULL if an error has occurred.

Annotations
@Nullable
@NativeType:JAWT_DrawingSurfaceInfo *
JAWT_DrawingSurface_Lockback to summary
public static int JAWT_DrawingSurface_Lock(JAWTDrawingSurface ds, long __functionAddress)

Locks the surface of the target component for native rendering. When finished drawing, the surface must be unlocked with DrawingSurface_Unlock.

Parameters
ds:JAWTDrawingSurface

the surface to lock

__functionAddress:long

the function address

Returns:int

a bitmask with one or more of the following values:

Annotations
@NativeType:jint
JAWT_DrawingSurface_Unlockback to summary
public static void JAWT_DrawingSurface_Unlock(JAWTDrawingSurface ds, long __functionAddress)

Unlocks the drawing surface of the target component for native rendering.

Parameters
ds:JAWTDrawingSurface

the surface to unlock

__functionAddress:long

the function address

JAWT_FreeDrawingSurfaceback to summary
public static void JAWT_FreeDrawingSurface(JAWTDrawingSurface ds, long __functionAddress)

Frees the drawing surface allocated in GetDrawingSurface.

Parameters
ds:JAWTDrawingSurface

the JAWTDrawingSurface to free

__functionAddress:long

the function address

JAWT_GetAWTback to summary
public static boolean JAWT_GetAWT(JAWT awt)

Returns the AWT native structure.

Parameters
awt:JAWT

the target JAWT struct

Returns:boolean

JNI_FALSE if an error occurs

Annotations
@NativeType:jboolean
JAWT_GetComponentback to summary
public static java.awt.Component JAWT_GetComponent(long platformInfo, long __functionAddress)

Returns a reference to a Component from a native platform handle. On Windows, this corresponds to an HWND; on Solaris and Linux, this is a Drawable. For other platforms, see the appropriate machine-dependent header file for a description. The reference returned by this function is a local reference that is only valid in this environment. This function returns a NULL reference if no component could be found with matching platform information.

Parameters
platformInfo:long

the native platform handle

__functionAddress:long

the function address

Annotations
@Nullable
@NativeType:jobject
JAWT_GetDrawingSurfaceback to summary
public static JAWTDrawingSurface JAWT_GetDrawingSurface(Object target, long __functionAddress)

Returns a drawing surface from a target jobject. This value may be cached.

FreeDrawingSurface must be called when finished with the returned JAWTDrawingSurface.

Parameters
target:Object

must be a Component (should be a Canvas or Window for native rendering)

__functionAddress:long

the function address

Returns:JAWTDrawingSurface

NULL if an error has occurred

Annotations
@Nullable
@NativeType:JAWT_DrawingSurface *
JAWT_Lockback to summary
public static void JAWT_Lock(long __functionAddress)

Locks the entire AWT for synchronization purposes.

Parameters
__functionAddress:long

the function address

JAWT_SetBoundsback to summary
public static void JAWT_SetBounds(java.awt.Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress)

Moves and resizes the embedded frame. The new location of the top-left corner is specified by x and y parameters relative to the native parent component. The new size is specified by width and height.

The embedded frame should be created by CreateEmbeddedFrame method, or this function will not have any effect.

Component#setLocation and Component#setBounds for EmbeddedFrame really don't move it within the native parent. These methods always locate the embedded frame at (0, 0) for backward compatibility. To allow moving embedded frames this method was introduced, and it works just the same way as setLocation() and setBounds() for usual, non-embedded components.

Using usual get/setLocation() and get/setBounds() together with this new method is not recommended.

Parameters
embeddedFrame:java.awt.Frame

the embedded frame

x:int

the x coordinate

y:int

the y coordinate

w:int

the width

h:int

the height

__functionAddress:long

the function address

Since
Java 9
JAWT_SynthesizeWindowActivationback to summary
public static void JAWT_SynthesizeWindowActivation(java.awt.Frame embeddedFrame, boolean doActivate, long __functionAddress)

Synthesizes a native message to activate or deactivate an EmbeddedFrame window depending on the value of parameter doActivate.

The embedded frame should be created by CreateEmbeddedFrame method, or this function will not have any effect.

Parameters
embeddedFrame:java.awt.Frame

the embedded frame

doActivate:boolean

if true activates the window; otherwise, deactivates the window

__functionAddress:long

the function address

Since
Java 9
JAWT_Unlockback to summary
public static void JAWT_Unlock(long __functionAddress)

Unlocks the entire AWT for synchronization purposes.

Parameters
__functionAddress:long

the function address

nJAWT_CreateEmbeddedFrameback to summary
public static native java.awt.Frame nJAWT_CreateEmbeddedFrame(long platformInfo, long __functionAddress)

Unsafe version of: CreateEmbeddedFrame

Annotations
@Nullable
nJAWT_DrawingSurface_FreeDrawingSurfaceInfoback to summary
public static void nJAWT_DrawingSurface_FreeDrawingSurfaceInfo(long dsi, long __functionAddress)

Unsafe version of: DrawingSurface_FreeDrawingSurfaceInfo

nJAWT_DrawingSurface_GetDrawingSurfaceInfoback to summary
public static long nJAWT_DrawingSurface_GetDrawingSurfaceInfo(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_GetDrawingSurfaceInfo

nJAWT_DrawingSurface_Lockback to summary
public static int nJAWT_DrawingSurface_Lock(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_Lock

nJAWT_DrawingSurface_Unlockback to summary
public static void nJAWT_DrawingSurface_Unlock(long ds, long __functionAddress)

Unsafe version of: DrawingSurface_Unlock

nJAWT_FreeDrawingSurfaceback to summary
public static void nJAWT_FreeDrawingSurface(long ds, long __functionAddress)

Unsafe version of: FreeDrawingSurface

nJAWT_GetAWTback to summary
public static native boolean nJAWT_GetAWT(long awt, long __functionAddress)

Unsafe version of: GetAWT

nJAWT_GetAWTback to summary
public static boolean nJAWT_GetAWT(long awt)

Unsafe version of: GetAWT

nJAWT_GetComponentback to summary
public static native java.awt.Component nJAWT_GetComponent(long platformInfo, long __functionAddress)

Unsafe version of: GetComponent

Annotations
@Nullable
nJAWT_GetDrawingSurfaceback to summary
public static native long nJAWT_GetDrawingSurface(Object target, long __functionAddress)

Unsafe version of: GetDrawingSurface

nJAWT_Lockback to summary
public static native void nJAWT_Lock(long __functionAddress)

Unsafe version of: Lock

nJAWT_SetBoundsback to summary
public static native void nJAWT_SetBounds(java.awt.Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress)

Unsafe version of: SetBounds

nJAWT_SynthesizeWindowActivationback to summary
public static native void nJAWT_SynthesizeWindowActivation(java.awt.Frame embeddedFrame, boolean doActivate, long __functionAddress)

Unsafe version of: SynthesizeWindowActivation

nJAWT_Unlockback to summary
public static native void nJAWT_Unlock(long __functionAddress)

Unsafe version of: Unlock

org.lwjgl.system.jawt back to summary

public final Class JAWTFunctions.Functions

extends Object
Class Inheritance

Contains the function pointers loaded from the jawt SharedLibrary.

Field Summary

Modifier and TypeField and Description
public static final long
GetAWT

Function address.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GetAWTback to summary
public static final long GetAWT

Function address.

Constructor Detail

Functionsback to summary
private Functions()