com.jogamp.newt

## Interface Window

- All Superinterfaces:
    NativeSurface, NativeSurfaceHolder, NativeWindow, ScalableSurface, SurfaceUpdatedListener, WindowClosingProtocol
  All Known Implementing Classes:
    GLWindow

      public interface Window
      extends NativeWindow, WindowClosingProtocol, ScalableSurface

  Specifying NEWT's Window functionality:
  - On- and offscreen windows
  - Keyboard and multi-pointer input
  - Native reparenting
  - Toggable fullscreen and decoration mode
  - Transparency
  - ... and more

  One use case is `GLWindow`, which delegates window operation to an instance of this interface while providing OpenGL functionality.

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

  ##### Coordinate System

  - Screen space has it's origin in the top-left corner, and may not be at 0/0.
  - Window origin is in it's top-left corner, see `NativeWindow.getX()` and `NativeWindow.getY()`.
  - Window client-area excludes `insets`, i.e. window decoration.
  - Window origin is relative to it's parent window if exist, or the screen position (top-level).
  See `NativeWindow` and `Screen`.

  ##### Custom Window Icons

  Custom window icons can be defined via system property `newt.window.icons`, which shall contain a space separated list of PNG icon locations from low- to high-resolution. The location must be resolvable via classpath, i.e. shall reference a location within the jar file. Example (our default):

         -Dnewt.window.icons="newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png"
         -Djnlp.newt.window.icons="newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png"

  The property can also be set programmatically, which must happen before any NEWT classes are touched:

         System.setProperty("newt.window.icons", "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png");

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Window.FocusRunnable`
    `static class` | `Window.ReparentOperation` Reparenting operation types

    - ### Nested classes/interfaces inherited from interface javax.media.nativewindow.WindowClosingProtocol

      `WindowClosingProtocol.WindowClosingMode`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEBUG_IMPLEMENTATION`
    `static boolean` | `DEBUG_KEY_EVENT`
    `static boolean` | `DEBUG_MOUSE_EVENT`
    `static int` | `REPARENT_HINT_BECOMES_VISIBLE` Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g.
    `static int` | `REPARENT_HINT_FORCE_RECREATION` Reparenting hint (bitfield value): Force destroy and hence `re-creating` the window.
    `static long` | `TIMEOUT_NATIVEWINDOW` A 1s timeout while waiting for a native action response, ie `setVisible(boolean)`.

    - ### Fields inherited from interface javax.media.nativewindow.NativeSurface

      `LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED`

    - ### Fields inherited from interface javax.media.nativewindow.ScalableSurface

      `AUTOMAX_PIXELSCALE, IDENTITY_PIXELSCALE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addChild(NativeWindow win)`
    `void` | `addGestureHandler(GestureHandler gh)` Appends the given `GestureHandler` to the end of the list.
    `void` | `addGestureHandler(int index, GestureHandler gh)` Inserts the given `GestureHandler` at the specified position in the list.
    `void` | `addGestureListener(GestureHandler.GestureListener gl)` Appends the given `GestureHandler.GestureListener` to the end of the list.
    `void` | `addGestureListener(int index, GestureHandler.GestureListener gl)` Inserts the given `GestureHandler.GestureListener` at the specified position in the list.
    `void` | `addKeyListener(int index, KeyListener l)` Inserts the given `KeyListener` at the specified position in the list.
    `void` | `addKeyListener(KeyListener l)` Appends the given `KeyListener` to the end of the list.
    `void` | `addMouseListener(int index, MouseListener l)` Inserts the given `MouseListener` at the specified position in the list.
    `void` | `addMouseListener(MouseListener l)` Appends the given `MouseListener` to the end of the list.
    `void` | `addWindowListener(int index, WindowListener l)` Inserts the given `WindowListener` at the specified position in the list.
    `void` | `addWindowListener(WindowListener l)` Appends the given `WindowListener` to the end of the list.
    `boolean` | `areDefaultGesturesEnabled()` Return true if default `GestureHandler` are enabled.
    `void` | `confinePointer(boolean confine)` Confine the pointer to this window, ie.
    `void` | `destroy()` Destroys this window incl.
    `void` | `enqueueEvent(boolean wait, NEWTEvent event)` Enqueues a `NEWT event`.
    `Rectangle` | `getBounds()` Returns a newly created `Rectangle` containing window origin, `NativeWindow.getX()` & `NativeWindow.getY()`, and size, `NativeWindow.getWidth()` & `NativeWindow.getHeight()`, in window units.
    `CapabilitiesImmutable` | `getChosenCapabilities()` Gets an immutable set of chosen capabilities.
    `Window` | `getDelegatedWindow()` If the implementation uses delegation, return the delegated `Window` instance, otherwise return `this` instance.
    `KeyListener` | `getKeyListener(int index)`
    `KeyListener[]` | `getKeyListeners()`
    `MonitorDevice` | `getMainMonitor()` Returns the `MonitorDevice` with the highest `viewport` `coverage` of this window.
    `MouseListener` | `getMouseListener(int index)` Returns the `MouseListener` from the list at the given index.
    `MouseListener[]` | `getMouseListeners()` Returns all `MouseListener`
    `float[]` | `getPixelsPerMM(float[] ppmmStore)` Returns the pixels per millimeter of this window's `NativeSurface` according to the `main monitor`'s current `mode`'s `surface resolution`.
    `Display.PointerIcon` | `getPointerIcon()` Returns the current `Display.PointerIcon`, which maybe `null` for the default.
    `CapabilitiesImmutable` | `getRequestedCapabilities()` Gets an immutable set of requested capabilities.
    `Screen` | `getScreen()`
    `String` | `getTitle()`
    `WindowListener` | `getWindowListener(int index)`
    `WindowListener[]` | `getWindowListeners()`
    `boolean` | `isAlwaysOnTop()`
    `boolean` | `isFullscreen()`
    `boolean` | `isKeyboardVisible()` Return `true` if the virtual on-screen keyboard is visible, otherwise `false`.
    `boolean` | `isNativeValid()`
    `boolean` | `isPointerConfined()`
    `boolean` | `isPointerVisible()`
    `boolean` | `isUndecorated()`
    `boolean` | `isVisible()`
    `boolean` | `removeChild(NativeWindow win)`
    `void` | `removeGestureHandler(GestureHandler gh)` Removes the given `GestureHandler` from the list.
    `void` | `removeGestureListener(GestureHandler.GestureListener gl)` Removes the given `GestureHandler.GestureListener` from the list.
    `void` | `removeKeyListener(KeyListener l)`
    `void` | `removeMouseListener(MouseListener l)` Removes the given `MouseListener` from the list.
    `void` | `removeWindowListener(WindowListener l)`
    `Window.ReparentOperation` | `reparentWindow(NativeWindow newParent, int x, int y, int hints)` Change this window's parent window.
    `void` | `requestFocus()` Request focus for this native window
    `void` | `requestFocus(boolean wait)` Request focus for this native window
    `void` | `runOnEDTIfAvail(boolean wait, Runnable task)`
    `void` | `sendWindowEvent(int eventType)` Send a `WindowEvent` to all `WindowListener`.
    `void` | `setAlwaysOnTop(boolean value)`
    `CapabilitiesChooser` | `setCapabilitiesChooser(CapabilitiesChooser chooser)` Set the CapabilitiesChooser to help determine the native visual type.
    `void` | `setDefaultGesturesEnabled(boolean enable)` Enable or disable default `GestureHandler`.
    `void` | `setFocusAction(Window.FocusRunnable focusAction)` Sets a `Window.FocusRunnable`, which `Window.FocusRunnable.run()` method is executed before the native focus is requested.
    `boolean` | `setFullscreen(boolean fullscreen)` Enable or disable fullscreen mode for this window.
    `boolean` | `setFullscreen(List<MonitorDevice> monitors)` Enable fullscreen mode for this window spanning across the given `MonitorDevice`s or across all `MonitorDevice`s.
    `void` | `setKeyboardFocusHandler(KeyListener l)` Sets a `KeyListener` allowing focus traversal with a covered window toolkit like AWT.
    `void` | `setKeyboardVisible(boolean visible)` In case the platform supports or even requires a virtual on-screen keyboard, this method shows or hide it depending on whether `visible` is `true` or `false`.
    `void` | `setPointerIcon(Display.PointerIcon pi)`
    `void` | `setPointerVisible(boolean pointerVisible)` Makes the pointer visible or invisible.
    `void` | `setPosition(int x, int y)` Sets the location of the window's client area excluding insets (window decorations) in window units. This call is ignored if in fullscreen mode.
    `void` | `setSize(int width, int height)` Sets the size of the window's client area in window units, excluding decorations.
    `void` | `setSurfaceSize(int pixelWidth, int pixelHeight)` Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.
    `void` | `setTitle(String title)`
    `void` | `setTopLevelPosition(int x, int y)` Sets the location of the top-level window inclusive insets (window decorations) in window units.
    `void` | `setTopLevelSize(int width, int height)` Sets the size of the top-level window including insets (window decorations) in window units.
    `void` | `setUndecorated(boolean value)`
    `void` | `setVisible(boolean visible)` Calls `setVisible(true, visible)`, i.e.
    `void` | `setVisible(boolean wait, boolean visible)` `setVisible(..)` makes the window and children visible if `visible` is true, otherwise the window and children becomes invisible.
    `void` | `setWindowDestroyNotifyAction(Runnable r)` Set a custom action handling destruction issued by a `toolkit triggered window destroy` replacing the default `destroy()` action.
    `void` | `warpPointer(int x, int y)` Moves the pointer to x/y relative to this window's origin in pixel units.
    `void` | `windowRepaint(int x, int y, int width, int height)` Trigger window repaint while passing the dirty region in pixel units.

    - ### Methods inherited from interface javax.media.nativewindow.NativeWindow

      `getHeight, getInsets, getLocationOnScreen, getNativeSurface, getParent, getWidth, getWindowHandle, getX, getY, hasFocus`

    - ### Methods inherited from interface javax.media.nativewindow.NativeSurface

      `addSurfaceUpdatedListener, addSurfaceUpdatedListener, convertToPixelUnits, convertToWindowUnits, getDisplayHandle, getGraphicsConfiguration, getScreenIndex, getSurfaceHandle, getSurfaceHeight, getSurfaceLockOwner, getSurfaceWidth, isSurfaceLockedByOtherThread, lockSurface, removeSurfaceUpdatedListener, surfaceSwap, unlockSurface`

    - ### Methods inherited from interface javax.media.nativewindow.SurfaceUpdatedListener

      `surfaceUpdated`

    - ### Methods inherited from interface javax.media.nativewindow.WindowClosingProtocol

      `getDefaultCloseOperation, setDefaultCloseOperation`

    - ### Methods inherited from interface javax.media.nativewindow.ScalableSurface

      `getCurrentSurfaceScale, getNativeSurfaceScale, getRequestedSurfaceScale, setSurfaceScale`

- - ### Field Detail

    - #### DEBUG_MOUSE_EVENT

          static final boolean DEBUG_MOUSE_EVENT

    - #### DEBUG_KEY_EVENT

          static final boolean DEBUG_KEY_EVENT

    - #### DEBUG_IMPLEMENTATION

          static final boolean DEBUG_IMPLEMENTATION

    - #### TIMEOUT_NATIVEWINDOW

          static final long TIMEOUT_NATIVEWINDOW

      A 1s timeout while waiting for a native action response, ie `setVisible(boolean)`.
      See Also:
        Constant Field Values

    - #### REPARENT_HINT_FORCE_RECREATION

          static final int REPARENT_HINT_FORCE_RECREATION

      Reparenting hint (bitfield value): Force destroy and hence `re-creating` the window.
      See Also:
        Constant Field Values

    - #### REPARENT_HINT_BECOMES_VISIBLE

          static final int REPARENT_HINT_BECOMES_VISIBLE

      Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### isNativeValid

          boolean isNativeValid()

      Returns:
        true if the native window handle is valid and ready to operate, ie if the native window has been created via `setVisible(true)`, otherwise false.
      See Also:
        `setVisible(boolean)`, `#destroy(boolean)`

    - #### getScreen

          Screen getScreen()

      Returns:
        The associated `Screen`

    - #### getMainMonitor

          MonitorDevice getMainMonitor()

      Returns the `MonitorDevice` with the highest `viewport` `coverage` of this window.

      If no coverage is detected the first `MonitorDevice` is returned.

    - #### setCapabilitiesChooser

          CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser)

      Set the CapabilitiesChooser to help determine the native visual type.
      Parameters:
        `chooser` - the new CapabilitiesChooser
      Returns:
        the previous CapabilitiesChooser

    - #### getRequestedCapabilities

          CapabilitiesImmutable getRequestedCapabilities()

      Gets an immutable set of requested capabilities.
      Returns:
        the requested capabilities

    - #### getChosenCapabilities

          CapabilitiesImmutable getChosenCapabilities()

      Gets an immutable set of chosen capabilities.
      Returns:
        the chosen capabilities

    - #### destroy

          void destroy()

      Destroys this window incl. releasing all related resources.

      Also iterates through this window's children and destroys them.

      Visibility is set to false.

      Method sends out `pre-` and `post-` destruction events to all of it's `WindowListener`.

      This method invokes `Screen.removeReference()` after it's own destruction,
      which will issue `Screen.destroy()` if the reference count becomes 0.
      This destruction sequence shall end up in `Display.destroy()`, if all reference counts become 0.

      The Window can be recreate via `setVisible(true)`.

      Specified by:
        `destroy` in interface `NativeWindow`
      See Also:
        `destroy()`, `setVisible(boolean)`

    - #### setWindowDestroyNotifyAction

          void setWindowDestroyNotifyAction(Runnable r)

      Set a custom action handling destruction issued by a `toolkit triggered window destroy` replacing the default `destroy()` action.

      The custom action shall call `destroy()` but may perform further tasks before and after.

    - #### setVisible

          void setVisible(boolean visible)

      Calls `setVisible(true, visible)`, i.e. blocks until the window becomes visible.
      See Also:
        `setVisible(boolean, boolean)`

    - #### setVisible

          void setVisible(boolean wait,
                        boolean visible)

      `setVisible(..)` makes the window and children visible if `visible` is true, otherwise the window and children becomes invisible.

      `setVisible(wait, true)` is responsible to actual create the native window.

      If `wait` is true, method blocks until window is `visible` and `valid`, otherwise method returns immediately.

      Zero size semantics are respected, see `setSize(int,int)`:

           if ( 0 == windowHandle && visible ) {
             this.visible = visible;
             if( 0 < width && 0 < height ) {
               createNative();
             }
           } else if ( this.visible != visible ) {
             this.visible = visible;
             setNativeSizeImpl();
           }

      In case this window is a child window and has a `NativeWindow` parent,
      `setVisible(wait, true)` has no effect as long the parent's is not valid yet, i.e. `NativeWindow.getWindowHandle()` returns `null`.
      `setVisible(wait, true)` shall be repeated when the parent becomes valid.

    - #### isVisible

          boolean isVisible()

    - #### getDelegatedWindow

          Window getDelegatedWindow()

      If the implementation uses delegation, return the delegated `Window` instance, otherwise return `this` instance.

    - #### addChild

          boolean addChild(NativeWindow win)

    - #### removeChild

          boolean removeChild(NativeWindow win)

    - #### getBounds

          Rectangle getBounds()

      Returns a newly created `Rectangle` containing window origin, `NativeWindow.getX()` & `NativeWindow.getY()`, and size, `NativeWindow.getWidth()` & `NativeWindow.getHeight()`, in window units.

    - #### getPixelsPerMM

          float[] getPixelsPerMM(float[] ppmmStore)

      Returns the pixels per millimeter of this window's `NativeSurface` according to the `main monitor`'s current `mode`'s `surface resolution`.

      Method takes the `current surface-scale` and `native surface-scale` into account, i.e.:

              surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale,
              with PpMM == pixel per millimeter

      To convert the result to dpi, i.e. dots-per-inch, multiply both components with `25.4f`.

      Parameters:
        `ppmmStore` - float[2] storage for the ppmm result
      Returns:
        the passed storage containing the ppmm for chaining

    - #### setSize

          void setSize(int width,
                     int height)

      Sets the size of the window's client area in window units, excluding decorations.

      Zero size semantics are respected, see `setVisible(boolean)`:

           if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) {
             setVisible(false);
           } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) {
             setVisible(true);
           } else {
             // as expected ..
           }

      This call is ignored if in fullscreen mode.

      Parameters:
        `width` - of the window's client area in window units
        `height` - of the window's client area in window units
      See Also:
        `setSurfaceSize(int, int)`, `setTopLevelSize(int, int)`, `NativeWindow.getInsets()`

    - #### setSurfaceSize

          void setSurfaceSize(int pixelWidth,
                            int pixelHeight)

      Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.

      In multiple monitor mode, setting the window's surface size in pixel units might not be possible due to unknown scale values of the target display. Hence re-setting the pixel unit size after window creation is recommended.

      Zero size semantics are respected, see `setVisible(boolean)`:

           if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) {
             setVisible(false);
           } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) {
             setVisible(true);
           } else {
             // as expected ..
           }

      This call is ignored if in fullscreen mode.

      Parameters:
        `pixelWidth` - of the window's client area in pixel units
        `pixelHeight` - of the window's client area in pixel units
      See Also:
        `setSize(int, int)`, `NativeWindow.getInsets()`

    - #### setTopLevelSize

          void setTopLevelSize(int width,
                             int height)

      Sets the size of the top-level window including insets (window decorations) in window units.

      Note: Insets (if supported) are available only after the window is set visible and hence has been created.

      Parameters:
        `width` - of the top-level window area in window units
        `height` - of the top-level window area in window units
      See Also:
        `setSize(int, int)`, `NativeWindow.getInsets()`

    - #### setPosition

          void setPosition(int x,
                         int y)

      Sets the location of the window's client area excluding insets (window decorations) in window units.
      This call is ignored if in fullscreen mode.
      Parameters:
        `x` - coord of the client-area's top left corner in window units
        `y` - coord of the client-area's top left corner in window units
      See Also:
        `NativeWindow.getInsets()`

    - #### setTopLevelPosition

          void setTopLevelPosition(int x,
                                 int y)

      Sets the location of the top-level window inclusive insets (window decorations) in window units.

      Note: Insets (if supported) are available only after the window is set visible and hence has been created.

      This call is ignored if in fullscreen mode.
      Parameters:
        `x` - coord of the top-level left corner in window units
        `y` - coord of the top-level left corner in window units
      See Also:
        `setPosition(int, int)`, `NativeWindow.getInsets()`

    - #### setUndecorated

          void setUndecorated(boolean value)

    - #### isUndecorated

          boolean isUndecorated()

    - #### setAlwaysOnTop

          void setAlwaysOnTop(boolean value)

    - #### isAlwaysOnTop

          boolean isAlwaysOnTop()

    - #### setTitle

          void setTitle(String title)

    - #### getTitle

          String getTitle()

    - #### isPointerVisible

          boolean isPointerVisible()

      See Also:
        `setPointerVisible(boolean)`

    - #### setPointerVisible

          void setPointerVisible(boolean pointerVisible)

      Makes the pointer visible or invisible.
      Parameters:
        `pointerVisible` - defaults to `true` for platforms w/ visible pointer, otherwise defaults to `true`, eg. Android.
      See Also:
        `confinePointer(boolean)`

    - #### getPointerIcon

          Display.PointerIcon getPointerIcon()

      Returns the current `Display.PointerIcon`, which maybe `null` for the default.
      See Also:
        `#setPointerIcon(PointerIcon)`

    - #### setPointerIcon

          void setPointerIcon(Display.PointerIcon pi)

      Parameters:
        `pi` - Valid `Display.PointerIcon` reference or `null` to reset the pointer icon to default.
      See Also:
        `Display.PointerIcon`, `Display.createPointerIcon(com.jogamp.common.util.IOUtil.ClassResources, int, int)`

    - #### isPointerConfined

          boolean isPointerConfined()

      See Also:
        `confinePointer(boolean)`

    - #### confinePointer

          void confinePointer(boolean confine)

      Confine the pointer to this window, ie. pointer jail.

      Before jailing the mouse pointer, the window request the focus and the pointer is centered in the window.

      In combination w/ `warpPointer(int, int)` and maybe `setPointerVisible(boolean)` a simple mouse navigation can be realized.

      Parameters:
        `confine` - defaults to `false`.

    - #### warpPointer

          void warpPointer(int x,
                         int y)

      Moves the pointer to x/y relative to this window's origin in pixel units.
      Parameters:
        `x` - relative pointer x position within this window in pixel units
        `y` - relative pointer y position within this window in pixel units
      See Also:
        `confinePointer(boolean)`

    - #### reparentWindow

          Window.ReparentOperation reparentWindow(NativeWindow newParent,
                                                int x,
                                                int y,
                                                int hints)

      Change this window's parent window.

      In case the old parent is not null and a Window, this window is removed from it's list of children.
      In case the new parent is not null and a Window, this window is added to it's list of children.

      Parameters:
        `newParent` - The new parent NativeWindow. If null, this Window becomes a top level window.
        `x` - new top-level position in window units, use -1 for default position.
        `y` - new top-level position in window units, use -1 for default position.
        `hints` - May contain hints (bitfield values) like `REPARENT_HINT_FORCE_RECREATION` or `REPARENT_HINT_BECOMES_VISIBLE`.
      Returns:
        The issued reparent action type (strategy) as defined in Window.ReparentAction

    - #### setFullscreen

          boolean setFullscreen(boolean fullscreen)

      Enable or disable fullscreen mode for this window.

      Fullscreen mode is established on the `main monitor`.

      Parameters:
        `fullscreen` - enable or disable fullscreen mode
      Returns:
        success
      See Also:
        `setFullscreen(List)`, `isFullscreen()`

    - #### setFullscreen

          boolean setFullscreen(List<MonitorDevice> monitors)

      Enable fullscreen mode for this window spanning across the given `MonitorDevice`s or across all `MonitorDevice`s.

      Disable fullscreen via `setFullscreen(boolean)`.

      Parameters:
        `monitors` - if `null` fullscreen will be spanned across all `MonitorDevice`s, otherwise across the given list of `MonitorDevice`.
      Returns:
        success
      See Also:
        `setFullscreen(boolean)`, `isFullscreen()`

    - #### isFullscreen

          boolean isFullscreen()

    - #### setFocusAction

          void setFocusAction(Window.FocusRunnable focusAction)

      Sets a `Window.FocusRunnable`, which `Window.FocusRunnable.run()` method is executed before the native focus is requested.

      This allows notifying a covered window toolkit like AWT that the focus is requested, hence focus traversal can be made transparent.

    - #### setKeyboardFocusHandler

          void setKeyboardFocusHandler(KeyListener l)

      Sets a `KeyListener` allowing focus traversal with a covered window toolkit like AWT.

      The `KeyListener` methods are invoked prior to all other `KeyListener`'s allowing to suppress the `KeyEvent` via the `NEWTEvent.consumedTag` and to perform focus traversal with a 3rd party toolkit.

      The `KeyListener` methods are not invoked for `auto-repeat` events.

      Parameters:
        `l` -

    - #### requestFocus

          void requestFocus()

      Request focus for this native window

      The request is handled on this Window EDT and blocked until finished.

      See Also:
        `requestFocus(boolean)`

    - #### requestFocus

          void requestFocus(boolean wait)

      Request focus for this native window

      The request is handled on this Window EDT.

      Parameters:
        `wait` - true if waiting until the request is executed, otherwise false
      See Also:
        `requestFocus()`

    - #### windowRepaint

          void windowRepaint(int x,
                           int y,
                           int width,
                           int height)

      Trigger window repaint while passing the dirty region in pixel units.
      Parameters:
        `x` - dirty-region y-pos in pixel units
        `y` - dirty-region x-pos in pixel units
        `width` - dirty-region width in pixel units
        `height` - dirty-region height in pixel units

    - #### enqueueEvent

          void enqueueEvent(boolean wait,
                          NEWTEvent event)

      Enqueues a `NEWT event`.
      Parameters:
        `wait` - Passing `true` will block until the event has been processed, otherwise method returns immediately.
        `event` - The `event` to enqueue.

    - #### runOnEDTIfAvail

          void runOnEDTIfAvail(boolean wait,
                             Runnable task)

    - #### sendWindowEvent

          void sendWindowEvent(int eventType)

      Send a `WindowEvent` to all `WindowListener`.
      Parameters:
        `eventType` - a `WindowEvent` type, e.g. `WindowEvent.EVENT_WINDOW_REPAINT`.

    - #### addWindowListener

          void addWindowListener(WindowListener l)

      Appends the given `WindowListener` to the end of the list.

    - #### addWindowListener

          void addWindowListener(int index,
                               WindowListener l)
                                 throws IndexOutOfBoundsException

      Inserts the given `WindowListener` at the specified position in the list.
      Parameters:
        `index` - 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().
        `l` - The listener object to be inserted
      Throws:
        `IndexOutOfBoundsException` - If the index is not within (0 <= index && index <= size()), or -1

    - #### removeWindowListener

          void removeWindowListener(WindowListener l)

    - #### getWindowListener

          WindowListener getWindowListener(int index)

    - #### getWindowListeners

          WindowListener[] getWindowListeners()

    - #### setKeyboardVisible

          void setKeyboardVisible(boolean visible)

      In case the platform supports or even requires a virtual on-screen keyboard, this method shows or hide it depending on whether `visible` is `true` or `false`.

      One known platform where NEWT supports this feature is `Android`.

    - #### isKeyboardVisible

          boolean isKeyboardVisible()

      Return `true` if the virtual on-screen keyboard is visible, otherwise `false`.

      Currently on `Android`, the only supported platform right now, there is no way to reliably be notified of the current keyboard state.
      It would be best, if your code does not rely on this information.

      See Also:
        `setKeyboardVisible(boolean)`

    - #### addKeyListener

          void addKeyListener(KeyListener l)

      Appends the given `KeyListener` to the end of the list.

    - #### addKeyListener

          void addKeyListener(int index,
                            KeyListener l)

      Inserts the given `KeyListener` at the specified position in the list.
      Parameters:
        `index` - 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().
        `l` - The listener object to be inserted
      Throws:
        `IndexOutOfBoundsException` - If the index is not within (0 <= index && index <= size()), or -1

    - #### removeKeyListener

          void removeKeyListener(KeyListener l)

    - #### getKeyListener

          KeyListener getKeyListener(int index)

    - #### getKeyListeners

          KeyListener[] getKeyListeners()

    - #### addMouseListener

          void addMouseListener(MouseListener l)

      Appends the given `MouseListener` to the end of the list.

    - #### addMouseListener

          void addMouseListener(int index,
                              MouseListener l)

      Inserts the given `MouseListener` at the specified position in the list.
      Parameters:
        `index` - 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().
        `l` - The listener object to be inserted
      Throws:
        `IndexOutOfBoundsException` - If the index is not within (0 <= index && index <= size()), or -1

    - #### removeMouseListener

          void removeMouseListener(MouseListener l)

      Removes the given `MouseListener` from the list.

    - #### getMouseListener

          MouseListener getMouseListener(int index)

      Returns the `MouseListener` from the list at the given index.

    - #### getMouseListeners

          MouseListener[] getMouseListeners()

      Returns all `MouseListener`

    - #### setDefaultGesturesEnabled

          void setDefaultGesturesEnabled(boolean enable)

      Enable or disable default `GestureHandler`. Default is enabled.

    - #### areDefaultGesturesEnabled

          boolean areDefaultGesturesEnabled()

      Return true if default `GestureHandler` are enabled.

    - #### addGestureHandler

          void addGestureHandler(GestureHandler gh)

      Appends the given `GestureHandler` to the end of the list.

    - #### addGestureHandler

          void addGestureHandler(int index,
                               GestureHandler gh)

      Inserts the given `GestureHandler` at the specified position in the list.
      Parameters:
        `index` - 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().
        `l` - The listener object to be inserted
      Throws:
        `IndexOutOfBoundsException` - If the index is not within (0 <= index && index <= size()), or -1

    - #### removeGestureHandler

          void removeGestureHandler(GestureHandler gh)

      Removes the given `GestureHandler` from the list.

    - #### addGestureListener

          void addGestureListener(GestureHandler.GestureListener gl)

      Appends the given `GestureHandler.GestureListener` to the end of the list.

    - #### addGestureListener

          void addGestureListener(int index,
                                GestureHandler.GestureListener gl)

      Inserts the given `GestureHandler.GestureListener` at the specified position in the list.
      Parameters:
        `index` - 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().
        `l` - The listener object to be inserted
      Throws:
        `IndexOutOfBoundsException` - If the index is not within (0 <= index && index <= size()), or -1

    - #### removeGestureListener

          void removeGestureListener(GestureHandler.GestureListener gl)

      Removes the given `GestureHandler.GestureListener` from the list.

Copyright 2010 JogAmp Community.