Java Code Examples for sun.awt.SunToolkit#checkAndSetPolicy()

The following examples show how to use sun.awt.SunToolkit#checkAndSetPolicy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Window.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 2
Source File: Dialog.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 3
Source File: Dialog.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 4
Source File: Window.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 5
Source File: Window.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 6
Source File: Dialog.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 7
Source File: Window.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 8
Source File: Dialog.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 9
Source File: Window.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 10
Source File: Dialog.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 11
Source File: Dialog.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException, HeadlessException
{
    GraphicsEnvironment.checkHeadless();

    java.io.ObjectInputStream.GetField fields =
        s.readFields();

    ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);

    try {
        checkModalityPermission(localModalityType);
    } catch (AccessControlException ace) {
        localModalityType = DEFAULT_MODALITY_TYPE;
    }

    // in 1.5 or earlier modalityType was absent, so use "modal" instead
    if (localModalityType == null) {
        this.modal = fields.get("modal", false);
        setModal(modal);
    } else {
        this.modalityType = localModalityType;
    }

    this.resizable = fields.get("resizable", true);
    this.undecorated = fields.get("undecorated", false);
    this.title = (String)fields.get("title", "");

    blockedWindows = new IdentityArrayList<>();

    SunToolkit.checkAndSetPolicy(this);

    initialized = true;

}
 
Example 12
Source File: Window.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void init(GraphicsConfiguration gc) {
    GraphicsEnvironment.checkHeadless();

    syncLWRequests = systemSyncLWRequests;

    weakThis = new WeakReference<Window>(this);
    addToWindowList();

    setWarningString();
    this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    this.visible = false;

    gc = initGC(gc);

    if (gc.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }
    setLayout(new BorderLayout());

    /* offset the initial location with the original of the screen */
    /* and any insets                                              */
    Rectangle screenBounds = gc.getBounds();
    Insets screenInsets = getToolkit().getScreenInsets(gc);
    int x = getX() + screenBounds.x + screenInsets.left;
    int y = getY() + screenBounds.y + screenInsets.top;
    if (x != this.x || y != this.y) {
        setLocation(x, y);
        /* reset after setLocation */
        setLocationByPlatform(locationByPlatformProp);
    }

    modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
    disposerRecord = new WindowDisposerRecord(appContext, this);
    sun.java2d.Disposer.addRecord(anchor, disposerRecord);

    SunToolkit.checkAndSetPolicy(this);
}
 
Example 13
Source File: Dialog.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs an initially invisible <code>Dialog</code> with the
 * specified owner <code>Window</code>, title and modality.
 *
 * @param owner the owner of the dialog. The owner must be an instance of
 *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 *     of their descendents or <code>null</code>
 * @param title the title of the dialog or <code>null</code> if this dialog
 *     has no title
 * @param modalityType specifies whether dialog blocks input to other
 *    windows when shown. <code>null</code> value and unsupported modality
 *    types are equivalent to <code>MODELESS</code>
 *
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>
 *     is not an instance of {@link java.awt.Dialog Dialog} or {@link
 *     java.awt.Frame Frame}
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s
 *     <code>GraphicsConfiguration</code> is not from a screen device
 * @exception HeadlessException when
 *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
 * @exception SecurityException if the calling thread does not have permission
 *     to create modal dialogs with the given <code>modalityType</code>
 *
 * @see java.awt.Dialog.ModalityType
 * @see java.awt.Dialog#setModal
 * @see java.awt.Dialog#setModalityType
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see java.awt.Toolkit#isModalityTypeSupported
 *
 * @since 1.6
 */
public Dialog(Window owner, String title, ModalityType modalityType) {
    super(owner);

    if ((owner != null) &&
        !(owner instanceof Frame) &&
        !(owner instanceof Dialog))
    {
        throw new IllegalArgumentException("Wrong parent window");
    }

    this.title = title;
    setModalityType(modalityType);
    SunToolkit.checkAndSetPolicy(this);
    initialized = true;
}
 
Example 14
Source File: Dialog.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an initially invisible <code>Dialog</code> with the
 * specified owner <code>Window</code>, title, modality and
 * <code>GraphicsConfiguration</code>.
 *
 * @param owner the owner of the dialog. The owner must be an instance of
 *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 *     of their descendents or <code>null</code>
 * @param title the title of the dialog or <code>null</code> if this dialog
 *     has no title
 * @param modalityType specifies whether dialog blocks input to other
 *    windows when shown. <code>null</code> value and unsupported modality
 *    types are equivalent to <code>MODELESS</code>
 * @param gc the <code>GraphicsConfiguration</code> of the target screen device;
 *     if <code>null</code>, the default system <code>GraphicsConfiguration</code>
 *     is assumed
 *
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>
 *     is not an instance of {@link java.awt.Dialog Dialog} or {@link
 *     java.awt.Frame Frame}
 * @exception java.lang.IllegalArgumentException if <code>gc</code>
 *     is not from a screen device
 * @exception HeadlessException when
 *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
 * @exception SecurityException if the calling thread does not have permission
 *     to create modal dialogs with the given <code>modalityType</code>
 *
 * @see java.awt.Dialog.ModalityType
 * @see java.awt.Dialog#setModal
 * @see java.awt.Dialog#setModalityType
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see java.awt.Toolkit#isModalityTypeSupported
 *
 * @since 1.6
 */
public Dialog(Window owner, String title, ModalityType modalityType,
              GraphicsConfiguration gc) {
    super(owner, gc);

    if ((owner != null) &&
        !(owner instanceof Frame) &&
        !(owner instanceof Dialog))
    {
        throw new IllegalArgumentException("wrong owner window");
    }

    this.title = title;
    setModalityType(modalityType);
    SunToolkit.checkAndSetPolicy(this);
    initialized = true;
}
 
Example 15
Source File: Dialog.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an initially invisible <code>Dialog</code> with the
 * specified owner <code>Window</code>, title and modality.
 *
 * @param owner the owner of the dialog. The owner must be an instance of
 *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 *     of their descendents or <code>null</code>
 * @param title the title of the dialog or <code>null</code> if this dialog
 *     has no title
 * @param modalityType specifies whether dialog blocks input to other
 *    windows when shown. <code>null</code> value and unsupported modality
 *    types are equivalent to <code>MODELESS</code>
 *
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>
 *     is not an instance of {@link java.awt.Dialog Dialog} or {@link
 *     java.awt.Frame Frame}
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s
 *     <code>GraphicsConfiguration</code> is not from a screen device
 * @exception HeadlessException when
 *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
 * @exception SecurityException if the calling thread does not have permission
 *     to create modal dialogs with the given <code>modalityType</code>
 *
 * @see java.awt.Dialog.ModalityType
 * @see java.awt.Dialog#setModal
 * @see java.awt.Dialog#setModalityType
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see java.awt.Toolkit#isModalityTypeSupported
 *
 * @since 1.6
 */
public Dialog(Window owner, String title, ModalityType modalityType) {
    super(owner);

    if ((owner != null) &&
        !(owner instanceof Frame) &&
        !(owner instanceof Dialog))
    {
        throw new IllegalArgumentException("Wrong parent window");
    }

    this.title = title;
    setModalityType(modalityType);
    SunToolkit.checkAndSetPolicy(this);
    initialized = true;
}
 
Example 16
Source File: Dialog.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an initially invisible <code>Dialog</code> with the
 * specified owner <code>Window</code>, title and modality.
 *
 * @param owner the owner of the dialog. The owner must be an instance of
 *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 *     of their descendents or <code>null</code>
 * @param title the title of the dialog or <code>null</code> if this dialog
 *     has no title
 * @param modalityType specifies whether dialog blocks input to other
 *    windows when shown. <code>null</code> value and unsupported modality
 *    types are equivalent to <code>MODELESS</code>
 *
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>
 *     is not an instance of {@link java.awt.Dialog Dialog} or {@link
 *     java.awt.Frame Frame}
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s
 *     <code>GraphicsConfiguration</code> is not from a screen device
 * @exception HeadlessException when
 *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
 * @exception SecurityException if the calling thread does not have permission
 *     to create modal dialogs with the given <code>modalityType</code>
 *
 * @see java.awt.Dialog.ModalityType
 * @see java.awt.Dialog#setModal
 * @see java.awt.Dialog#setModalityType
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see java.awt.Toolkit#isModalityTypeSupported
 *
 * @since 1.6
 */
public Dialog(Window owner, String title, ModalityType modalityType) {
    super(owner);

    if ((owner != null) &&
        !(owner instanceof Frame) &&
        !(owner instanceof Dialog))
    {
        throw new IllegalArgumentException("Wrong parent window");
    }

    this.title = title;
    setModalityType(modalityType);
    SunToolkit.checkAndSetPolicy(this);
    initialized = true;
}
 
Example 17
Source File: Frame.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void init(String title, GraphicsConfiguration gc) {
    this.title = title;
    SunToolkit.checkAndSetPolicy(this);
}
 
Example 18
Source File: Frame.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void init(String title, GraphicsConfiguration gc) {
    this.title = title;
    SunToolkit.checkAndSetPolicy(this);
}
 
Example 19
Source File: Frame.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
private void init(String title, GraphicsConfiguration gc) {
    this.title = title;
    SunToolkit.checkAndSetPolicy(this);
}
 
Example 20
Source File: Dialog.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Constructs an initially invisible <code>Dialog</code> with the
 * specified owner <code>Window</code>, title, modality and
 * <code>GraphicsConfiguration</code>.
 *
 * @param owner the owner of the dialog. The owner must be an instance of
 *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 *     of their descendents or <code>null</code>
 * @param title the title of the dialog or <code>null</code> if this dialog
 *     has no title
 * @param modalityType specifies whether dialog blocks input to other
 *    windows when shown. <code>null</code> value and unsupported modality
 *    types are equivalent to <code>MODELESS</code>
 * @param gc the <code>GraphicsConfiguration</code> of the target screen device;
 *     if <code>null</code>, the default system <code>GraphicsConfiguration</code>
 *     is assumed
 *
 * @exception java.lang.IllegalArgumentException if the <code>owner</code>
 *     is not an instance of {@link java.awt.Dialog Dialog} or {@link
 *     java.awt.Frame Frame}
 * @exception java.lang.IllegalArgumentException if <code>gc</code>
 *     is not from a screen device
 * @exception HeadlessException when
 *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
 * @exception SecurityException if the calling thread does not have permission
 *     to create modal dialogs with the given <code>modalityType</code>
 *
 * @see java.awt.Dialog.ModalityType
 * @see java.awt.Dialog#setModal
 * @see java.awt.Dialog#setModalityType
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see java.awt.Toolkit#isModalityTypeSupported
 *
 * @since 1.6
 */
public Dialog(Window owner, String title, ModalityType modalityType,
              GraphicsConfiguration gc) {
    super(owner, gc);

    if ((owner != null) &&
        !(owner instanceof Frame) &&
        !(owner instanceof Dialog))
    {
        throw new IllegalArgumentException("wrong owner window");
    }

    this.title = title;
    setModalityType(modalityType);
    SunToolkit.checkAndSetPolicy(this);
    initialized = true;
}