public static boolean showDialog(AppSettings sourceSettings, URL imageFile, boolean loadSettings) {
        if (SwingUtilities.isEventDispatchThread()) {
            throw new IllegalStateException("Cannot run from EDT");
        }
        if (GraphicsEnvironment.isHeadless()) {
            throw new IllegalStateException("Cannot show dialog in headless environment");
        }

        AppSettings settings = new AppSettings(false);
        settings.copyFrom(sourceSettings);

        Object lock = new Object();
        AtomicBoolean done = new AtomicBoolean();
        AtomicInteger result = new AtomicInteger();
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                final SelectionListener selectionListener = new SelectionListener() {
                    @Override
                    public void onSelection(int selection) {
                        synchronized (lock) {
                            done.set(true);
                            result.set(selection);
                            lock.notifyAll();
                        }
                    }
                };
                AWTSettingsDialog dialog = new AWTSettingsDialog(settings, imageFile, loadSettings);
                dialog.setSelectionListener(selectionListener);
                dialog.showDialog();
            }
        });
        synchronized (lock) {
            while (!done.get()) {
                try {
                    lock.wait();
                } catch (InterruptedException ex) {
                }
            }
        }

        sourceSettings.copyFrom(settings);

        return result.get() == AWTSettingsDialog.APPROVE_SELECTION;
    }
<code>SettingsDialog</code> displays a Swing dialog box to interactively
configure the <code>AppSettings</code> of a desktop application before
<code>start()</code> is invoked.

The <code>AppSettings</code> instance to be configured is passed to the
constructor.

@see AppSettings
@author Mark Powell
@author Eric Woroshow
@author Joshua Slack - reworked for proper use of GL commands.
jme3-awt-dialogs/src/main/java/com/jme3/awt/AWTSettingsDialog.java