com.jogamp.nativewindow.awt

## Class AWTWindowClosingProtocol

- java.lang.Object
- - com.jogamp.nativewindow.awt.AWTWindowClosingProtocol

- All Implemented Interfaces:
    WindowClosingProtocol

      public class AWTWindowClosingProtocol
      extends Object
      implements WindowClosingProtocol

- - ### Nested Class Summary

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

      `WindowClosingProtocol.WindowClosingMode`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AWTWindowClosingProtocol(Component comp, Runnable closingOperationClose, Runnable closingOperationNOP)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addClosingListener()` Adds this closing listener to the components Window if exist and only one time.
    `WindowClosingProtocol.WindowClosingMode` | `getDefaultCloseOperation()`
    `boolean` | `removeClosingListener()`
    `WindowClosingProtocol.WindowClosingMode` | `setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op)`

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

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

- - ### Constructor Detail

    - #### AWTWindowClosingProtocol

          public AWTWindowClosingProtocol(Component comp,
                                  Runnable closingOperationClose,
                                  Runnable closingOperationNOP)

      Parameters:
        `comp` - mandatory AWT component which AWT Window is being queried by parent traversal
        `closingOperationClose` - mandatory closing operation, triggered if windowClosing and `WindowClosingMode#DISPOSE_ON_CLOSE`
        `closingOperationNOP` - optional closing operation, triggered if windowClosing and `WindowClosingMode#DO_NOTHING_ON_CLOSE`

  - ### Method Detail

    - #### addClosingListener

          public final boolean addClosingListener()
                                           throws IllegalStateException

      Adds this closing listener to the components Window if exist and only one time.

      If the closing listener is already added, and `IllegalStateException` is thrown.

      Returns:
        true if added, otherwise false.
      Throws:
        `IllegalStateException`

    - #### removeClosingListener

          public final boolean removeClosingListener()

    - #### getDefaultCloseOperation

          public final WindowClosingProtocol.WindowClosingMode getDefaultCloseOperation()

      Specified by:
        `getDefaultCloseOperation` in interface `WindowClosingProtocol`
      Returns:
        the user set close operation if set by `setDefaultCloseOperation(int)`, otherwise return the AWT/Swing close operation value translated to a `WindowClosingProtocol` value .
      See Also:
        `WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE`, `WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE`

    - #### setDefaultCloseOperation

          public final WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op)

      Specified by:
        `setDefaultCloseOperation` in interface `WindowClosingProtocol`
      Parameters:
        `op` - the new close operation value
      Returns:
        the previous close operation value
      See Also:
        `WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE`, `WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE`

Copyright 2010 JogAmp Community.