Package com.jme3.awt

Class AWTSettingsDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public final class AWTSettingsDialog extends JFrame
`AWTSettingsDialog` displays a Swing dialog box to interactively configure the `AppSettings` of a desktop application before `start()` is invoked.

The `AppSettings` instance to be configured is passed to the constructor.

Author:
Mark Powell, Eric Woroshow, Joshua Slack - reworked for proper use of GL commands.
See Also:
  • Field Details

    • NO_SELECTION

      public static final int NO_SELECTION
      Indicates that no selection has been made yet.
      See Also:
    • APPROVE_SELECTION

      public static final int APPROVE_SELECTION
      Indicates that the user approved the settings.
      See Also:
    • CANCEL_SELECTION

      public static final int CANCEL_SELECTION
      Indicates that the user canceled the settings dialog.
      See Also:
  • Constructor Details

    • AWTSettingsDialog

      protected AWTSettingsDialog(com.jme3.system.AppSettings source, String imageFile, boolean loadSettings)
      Constructs a `SettingsDialog` for the primary display.
      Parameters:
      source - The `AppSettings` instance to configure (not null).
      imageFile - The path to the image file to use as the title of the dialog; `null` will result in no image being displayed.
      loadSettings - If `true`, the dialog will copy settings from preferences. If `false` and preferences exist, they will be merged with the current settings.
      Throws:
      IllegalArgumentException - if `source` is `null`.
    • AWTSettingsDialog

      protected AWTSettingsDialog(com.jme3.system.AppSettings source, URL imageFile, boolean loadSettings)
      Constructs a `SettingsDialog` for the primary display.
      Parameters:
      source - The `AppSettings` instance to configure (not null).
      imageFile - The `URL` pointing to the image file to use as the title of the dialog; `null` will result in no image being displayed.
      loadSettings - If `true`, the dialog will copy settings from preferences. If `false` and preferences exist, they will be merged with the current settings.
      Throws:
      IllegalArgumentException - if `source` is `null`.
  • Method Details

    • showDialog

      public static boolean showDialog(com.jme3.system.AppSettings sourceSettings)
      Displays a settings dialog using the provided `AppSettings` source. Settings will be loaded from preferences.
      Parameters:
      sourceSettings - The `AppSettings` instance to configure.
      Returns:
      `true` if the user approved the settings, `false` otherwise.
    • showDialog

      public static boolean showDialog(com.jme3.system.AppSettings sourceSettings, boolean loadSettings)
      Displays a settings dialog using the provided `AppSettings` source.
      Parameters:
      sourceSettings - The `AppSettings` instance to configure.
      loadSettings - If `true`, settings will be loaded from preferences; otherwise, they will be merged.
      Returns:
      `true` if the user approved the settings, `false` otherwise.
    • showDialog

      public static boolean showDialog(com.jme3.system.AppSettings sourceSettings, String imageFile, boolean loadSettings)
      Displays a settings dialog using the provided `AppSettings` source and an image file path.
      Parameters:
      sourceSettings - The `AppSettings` instance to configure.
      imageFile - The path to the image file to use as the title of the dialog; `null` will result in no image being displayed.
      loadSettings - If `true`, settings will be loaded from preferences; otherwise, they will be merged.
      Returns:
      `true` if the user approved the settings, `false` otherwise.
    • showDialog

      public static boolean showDialog(com.jme3.system.AppSettings sourceSettings, URL imageFile, boolean loadSettings)
      Displays a settings dialog using the provided `AppSettings` source and an image URL. This method blocks until the dialog is closed.
      Parameters:
      sourceSettings - The `AppSettings` instance to configure (not null).
      imageFile - The `URL` pointing to the image file to use as the title of the dialog; `null` will result in no image being displayed.
      loadSettings - If `true`, the dialog will copy settings from preferences. If `false` and preferences exist, they will be merged with the current settings.
      Returns:
      `true` if the user approved the settings, `false` otherwise (`CANCEL_SELECTION` or dialog close).
    • setSelectionListener

      public void setSelectionListener(AWTSettingsDialog.SelectionListener sl)
    • getUserSelection

      public int getUserSelection()
    • getMinWidth

      public int getMinWidth()
    • setMinWidth

      public void setMinWidth(int minWidth)
    • getMinHeight

      public int getMinHeight()
    • setMinHeight

      public void setMinHeight(int minHeight)
    • setImage

      public void setImage(String image)
      setImage sets the background image of the dialog.
      Parameters:
      image - String representing the image file.
    • setImage

      public void setImage(URL image)
      setImage sets the background image of this dialog.
      Parameters:
      image - URL pointing to the image file.
    • showDialog

      public void showDialog()
      showDialog sets this dialog as visible, and brings it to the front.