Package icyllis.modernui.core.awt

# Class AWT

java.lang.Object
icyllis.modernui.core.awt.AWT

All Implemented Interfaces:
  `AutoCloseable`

public class AWT extends Object implements AutoCloseable
Creates and manages the native AWT object with ease.

Example 1:

     	Component c = ...;
     	try(AWT awt = new AWT(c)) {
     	    long pPlatformInfo = awt.getPlatformInfo();
     	    // ... do something with the platform info
        }
     	// The AWT object is automatically freed!

Example 2:

     	Component c = ...;
     	AWT awt = new AWT(c);
     	long pPlatformInfo = awt.getPlatformInfo();
     	// ... do something with the platform info
     	awt.close();

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AWT(Component component)`
  Initializes native window handlers from the desired AWT component.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Frees memory and unlocks the drawing surface.
  `org.lwjgl.system.jawt.JAWTDrawingSurfaceInfo`
  `getDrawingSurfaceInfo()`
  Gets the underlying platform drawing surface struct.
  `long`
  `getPlatformInfo()`
  Returns a pointer to a platform-specific struct with platform-specific information.
  `static boolean`
  `isPlatformSupported()`
  Checks if the platform is supported.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AWT

    public AWT(Component component) throws AWTException
    Initializes native window handlers from the desired AWT component. The component MUST be a `Component`, but should be a canvas or window for native rendering.

    If not used in a try-with-resources block, call `close()` when done.

    Parameters:
      `component` - a component to render onto
    Throws:
      `AWTException` - Fails for one of the provided reasons:
      - if the JAWT library failed to initialize;
      - if the drawing surface could not be retrieved;
      - if JAWT failed to lock the drawing surface;
      - or if JAWT failed to get information about the drawing surface;

- ## Method Details

  - ### isPlatformSupported

    public static boolean isPlatformSupported()
    Checks if the platform is supported. The OS version is not checked, but the architecture (e.g. 32 or 64 bit) is.
    Returns:
      true if the platform is supported

  - ### getPlatformInfo

    public long getPlatformInfo()
    Returns a pointer to a platform-specific struct with platform-specific information.

    The pointer can be safely used as a `JAWTWin32DrawingSurfaceInfo` or `JAWTX11DrawingSurfaceInfo` struct, or--if on MacOS-- a pointer to an `NSObject`.

    On win32 or X11 platforms, this can easily be created in Java via LWJGL's `#create(long)` method.

    Returns:
      pointer to platform-specific data

  - ### getDrawingSurfaceInfo

    public org.lwjgl.system.jawt.JAWTDrawingSurfaceInfo getDrawingSurfaceInfo()
    Gets the underlying platform drawing surface struct.
    Returns:
      the drawing surface

  - ### close

    public void close()
    Frees memory and unlocks the drawing surface.
    Specified by:
      `close` in interface `AutoCloseable`