com.jogamp.newt

## Class Display

- java.lang.Object
- - com.jogamp.newt.Display

-     public abstract class Display
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Display.PointerIcon` Native PointerIcon handle.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEBUG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Display()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `addReference()` The 1st call will initiate native creation, since we follow the lazy creation pattern.
    `abstract void` | `createNative()` Manual trigger the native creation, if it is not done yet. This is useful to be able to request the `AbstractGraphicsDevice`, via `getGraphicsDevice()`. Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.
    `abstract Display.PointerIcon` | `createPointerIcon(IOUtil.ClassResources pngResource, int hotX, int hotY)` Returns the newly created `Display.PointerIcon` or `null` if not implemented on platform.
    `abstract Display.PointerIcon` | `createPointerIcon(PixelRectangle pixelrect, int hotX, int hotY)` Returns the newly created `Display.PointerIcon` or `null` if not implemented on platform.
    `abstract void` | `destroy()` Manually trigger the destruction, incl.
    `abstract void` | `dispatchMessages()`
    `static void` | `dumpDisplayList(String prefix)`
    `boolean` | `equals(Object obj)` return true if obj is of type Display and both FQN `getFQName()` equals
    `static int` | `getActiveDisplayNumber()`
    `static Collection<Display>` | `getAllDisplays()` Returns the global display collection
    `abstract EDTUtil` | `getEDTUtil()`
    `static Display` | `getFirstDisplayOf(String type, String name, int fromIndex, boolean shared)`
    `abstract String` | `getFQName()`
    `abstract AbstractGraphicsDevice` | `getGraphicsDevice()` Return the `AbstractGraphicsDevice` used for depending resources lifecycle, i.e.
    `abstract long` | `getHandle()` Return the handle of the `AbstractGraphicsDevice` as returned by `getGraphicsDevice()`.
    `abstract int` | `getId()`
    `static Display` | `getLastDisplayOf(String type, String name, int fromIndex, boolean shared)`
    `abstract String` | `getName()`
    `abstract boolean` | `getNativePointerIconForceDirectNIO()` Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.
    `abstract PixelFormat` | `getNativePointerIconPixelFormat()` Returns the native platform's `PixelFormat` for pointer-icon pixel data.
    `abstract int` | `getReferenceCount()`
    `static String` | `getThreadName()`
    `abstract String` | `getType()`
    `abstract int` | `hashCode()` return precomputed hashCode from FQN `getFQName()`
    `static int` | `hashCodeNullSafe(Object o)`
    `abstract boolean` | `isEDTRunning()`
    `abstract boolean` | `isExclusive()` Return true if this instance is exclusive, i.e.
    `abstract boolean` | `isNativeValid()`
    `abstract int` | `removeReference()` The last call may destroy this instance, if `#getDestroyWhenUnused()` returns `true`.
    `abstract EDTUtil` | `setEDTUtil(EDTUtil usrEDTUtil)` Sets a new `EDTUtil` and returns the previous one.
    `static String` | `toHexString(int hex)`
    `static String` | `toHexString(long hex)`
    `abstract boolean` | `validateEDTStopped()` Validate EDT running state. Stop the running EDT in case this display is destroyed already.

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

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEBUG

          public static final boolean DEBUG

  - ### Constructor Detail

    - #### Display

          public Display()

  - ### Method Detail

    - #### hashCode

          public abstract int hashCode()

      return precomputed hashCode from FQN `getFQName()`
      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      return true if obj is of type Display and both FQN `getFQName()` equals
      Overrides:
        `equals` in class `Object`

    - #### getNativePointerIconPixelFormat

          public abstract PixelFormat getNativePointerIconPixelFormat()

      Returns the native platform's `PixelFormat` for pointer-icon pixel data.

      Using this value will avoid conversion within `createPointerIcon(PixelRectangle, int, int)`.

    - #### getNativePointerIconForceDirectNIO

          public abstract boolean getNativePointerIconForceDirectNIO()

      Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.

      Using this value will avoid conversion within `createPointerIcon(PixelRectangle, int, int)`.

    - #### createPointerIcon

          public abstract Display.PointerIcon createPointerIcon(IOUtil.ClassResources pngResource,
                                              int hotX,
                                              int hotY)
                                                         throws IllegalArgumentException,
                                                                IllegalStateException,
                                                                IOException

      Returns the newly created `Display.PointerIcon` or `null` if not implemented on platform.

      See `Display.PointerIcon` for lifecycle semantics.

      Parameters:
        `pngResource` - single PNG resource for the `Display.PointerIcon`. Only the first entry of `IOUtil.ClassResources#resourcePaths` is used.
        `hotX` - pointer hotspot x-coord, origin is upper-left corner
        `hotY` - pointer hotspot y-coord, origin is upper-left corner
      Throws:
        `IllegalArgumentException` - if pngResource is null or invalid
        `IllegalStateException` - if this Display instance is not `valid yet`.
        `IOException` - if the `pngResource` could not be `resolved` or via the PNG parser processing the input stream.
      See Also:
        `Display.PointerIcon`, `Window#setPointerIcon(PointerIcon)`

    - #### createPointerIcon

          public abstract Display.PointerIcon createPointerIcon(PixelRectangle pixelrect,
                                              int hotX,
                                              int hotY)
                                                         throws IllegalArgumentException,
                                                                IllegalStateException

      Returns the newly created `Display.PointerIcon` or `null` if not implemented on platform.

      See `Display.PointerIcon` for lifecycle semantics.

      In case `getNativePointerIconPixelFormat()` or `getNativePointerIconForceDirectNIO()` is not matched by the given `pixelrect`, the `pixelrect` is converted into the required `PixelFormat` and NIO type.

      Parameters:
        `pixelrect` - `PixelRectangle` source for the `Display.PointerIcon`
        `hotX` - pointer hotspot x-coord, origin is upper-left corner
        `hotY` - pointer hotspot y-coord, origin is upper-left corner
      Throws:
        `IllegalArgumentException` - if pixelrect is null.
        `IllegalStateException` - if this Display instance is not `valid yet`.
      See Also:
        `Display.PointerIcon`, `Window#setPointerIcon(PointerIcon)`, `getNativePointerIconPixelFormat()`, `getNativePointerIconForceDirectNIO()`

    - #### createNative

          public abstract void createNative()
                                     throws NativeWindowException

      Manual trigger the native creation, if it is not done yet.
      This is useful to be able to request the `AbstractGraphicsDevice`, via `getGraphicsDevice()`.
      Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.

      This method is usually invoke by `addReference()`

      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()`

    - #### validateEDTStopped

          public abstract boolean validateEDTStopped()

      Validate EDT running state.
      Stop the running EDT in case this display is destroyed already.
      Returns:
        true if EDT has been stopped (destroyed but running), otherwise false.

    - #### isNativeValid

          public abstract boolean isNativeValid()

      Returns:
        true if the native display handle is valid and ready to operate, otherwise false.
      See Also:
        `destroy()`

    - #### getReferenceCount

          public abstract int getReferenceCount()

      Returns:
        number of references

    - #### addReference

          public abstract int addReference()
                                    throws NativeWindowException

      The 1st call will initiate native creation, since we follow the lazy creation pattern.
      Returns:
        number of references post operation
      Throws:
        `NativeWindowException` - if the native creation failed.
      See Also:
        `removeReference()`

    - #### removeReference

          public abstract int removeReference()

      The last call may destroy this instance, if `#getDestroyWhenUnused()` returns `true`.
      Returns:
        number of references post operation
      See Also:
        `addReference()`, `#getDestroyWhenUnused()`, `#setDestroyWhenUnused(boolean)`

    - #### getGraphicsDevice

          public abstract AbstractGraphicsDevice getGraphicsDevice()

      Return the `AbstractGraphicsDevice` used for depending resources lifecycle, i.e. `Screen` and `Window`, as well as the event dispatching (EDT).

    - #### getHandle

          public abstract long getHandle()

      Return the handle of the `AbstractGraphicsDevice` as returned by `getGraphicsDevice()`.

    - #### getFQName

          public abstract String getFQName()

      Returns:
        The fully qualified Display name, which is a key of `getType()` + `getName()` + `getId()`.

    - #### getId

          public abstract int getId()

      Returns:
        this display internal serial id

    - #### getName

          public abstract String getName()

      Returns:
        This display connection name as defined at creation time. The display connection name is a technical platform specific detail, see `AbstractGraphicsDevice.getConnection()`.
      See Also:
        `AbstractGraphicsDevice.getConnection()`

    - #### getType

          public abstract String getType()

      Returns:
        the native display type, ie `NativeWindowFactory.getNativeWindowType(boolean)`

    - #### isExclusive

          public abstract boolean isExclusive()

      Return true if this instance is exclusive, i.e. will not be shared.

    - #### setEDTUtil

          public abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil)

      Sets a new `EDTUtil` and returns the previous one.

      If `usrEDTUtil` is `null`, the device's default EDTUtil is created and used.

      If a previous one exists and it differs from `usrEDTUtil`, it's being stopped, wait-until-idle.

      If `usrEDTUtil` is not null and equals the previous one, no change is being made.

    - #### getEDTUtil

          public abstract EDTUtil getEDTUtil()

    - #### isEDTRunning

          public abstract boolean isEDTRunning()

      Returns:
        true if EDT is running and not subject to be stopped, otherwise false.

    - #### dispatchMessages

          public abstract void dispatchMessages()

    - #### dumpDisplayList

          public static void dumpDisplayList(String prefix)

    - #### getFirstDisplayOf

          public static Display getFirstDisplayOf(String type,
                                  String name,
                                  int fromIndex,
                                  boolean shared)

      Parameters:
        `type` -
        `name` -
        `fromIndex` - start index, then increasing until found or end of list
      Returns:

    - #### getLastDisplayOf

          public static Display getLastDisplayOf(String type,
                                 String name,
                                 int fromIndex,
                                 boolean shared)

      Parameters:
        `type` -
        `name` -
        `fromIndex` - start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
      Returns:

    - #### getAllDisplays

          public static Collection<Display> getAllDisplays()

      Returns the global display collection

    - #### getActiveDisplayNumber

          public static int getActiveDisplayNumber()

    - #### getThreadName

          public static String getThreadName()

    - #### toHexString

          public static String toHexString(int hex)

    - #### toHexString

          public static String toHexString(long hex)

    - #### hashCodeNullSafe

          public static int hashCodeNullSafe(Object o)

Copyright 2010 JogAmp Community.