Dialog.java revision 872
555N/A * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * A Dialog is a top-level window with a title and a border 0N/A * that is typically used to take some form of input from the user. 0N/A * The size of the dialog includes any area designated for the 0N/A * border. The dimensions of the border area can be obtained 0N/A * using the <code>getInsets</code> method, however, since 0N/A * these dimensions are platform-dependent, a valid insets 0N/A * value cannot be obtained until the dialog is made displayable 0N/A * by either calling <code>pack</code> or <code>show</code>. 0N/A * Since the border area is included in the overall size of the 0N/A * dialog, the border effectively obscures a portion of the dialog, 0N/A * constraining the area available for rendering and/or displaying 0N/A * subcomponents to the rectangle which has an upper-left corner 0N/A * location of <code>(insets.left, insets.top)</code>, and has a size of 0N/A * <code>width - (insets.left + insets.right)</code> by 0N/A * <code>height - (insets.top + insets.bottom)</code>. 0N/A * The default layout for a dialog is <code>BorderLayout</code>. 0N/A * A dialog may have its native decorations (i.e. Frame & Titlebar) turned off 0N/A * with <code>setUndecorated</code>. This can only be done while the dialog 0N/A * is not {@link Component#isDisplayable() displayable}. 0N/A * A dialog may have another window as its owner when it's constructed. When 0N/A * the owner window of a visible dialog is minimized, the dialog will 0N/A * automatically be hidden from the user. When the owner window is subsequently 0N/A * restored, the dialog is made visible to the user again. 0N/A * In a multi-screen environment, you can create a <code>Dialog</code> 0N/A * on a different screen device than its owner. See {@link java.awt.Frame} for 0N/A * A dialog can be either modeless (the default) or modal. A modal 0N/A * dialog is one which blocks input to some other top-level windows 0N/A * in the application, except for any windows created with the dialog 0N/A * specification for details. 0N/A * Dialogs are capable of generating the following 0N/A * <code>WindowEvents</code>: 0N/A * <code>WindowOpened</code>, <code>WindowClosing</code>, 0N/A * <code>WindowClosed</code>, <code>WindowActivated</code>, 0N/A * <code>WindowDeactivated</code>, <code>WindowGainedFocus</code>, 0N/A * <code>WindowLostFocus</code>. 0N/A * @see Window#addWindowListener 0N/A * @author Sami Shaio 0N/A * @author Arthur van Hoff 0N/A /* ensure that the necessary native libraries are loaded */ 0N/A * A dialog's resizable property. Will be true 0N/A * if the Dialog is to be resizable, otherwise 0N/A * @see #setResizable(boolean) 0N/A * This field indicates whether the dialog is undecorated. 0N/A * This property can only be changed while the dialog is not displayable. 0N/A * <code>undecorated</code> will be true if the dialog is 0N/A * undecorated, otherwise it will be false. 0N/A * @see #setUndecorated(boolean) 0N/A * @see #isUndecorated() 0N/A * @see Component#isDisplayable() 0N/A * Modal dialogs block all input to some top-level windows. 0N/A * Whether a particular window is blocked depends on dialog's type 0N/A * of modality; this is called the "scope of blocking". The 0N/A * <code>ModalityType</code> enum specifies modal types and their 0N/A * associated scopes. 0N/A * @see Dialog#getModalityType 0N/A * @see Dialog#setModalityType 0N/A * @see Toolkit#isModalityTypeSupported 0N/A * <code>MODELESS</code> dialog doesn't block any top-level windows. 0N/A * A <code>DOCUMENT_MODAL</code> dialog blocks input to all top-level windows 0N/A * from the same document except those from its own child hierarchy. 0N/A * A document is a top-level window without an owner. It may contain child 0N/A * windows that, together with the top-level window are treated as a single 0N/A * solid document. Since every top-level window must belong to some 0N/A * document, its root can be found as the top-nearest window without an owner. 0N/A * An <code>APPLICATION_MODAL</code> dialog blocks all top-level windows 0N/A * from the same Java application except those from its own child hierarchy. 0N/A * If there are several applets launched in a browser, they can be 0N/A * treated either as separate applications or a single one. This behavior 0N/A * is implementation-dependent. 0N/A * A <code>TOOLKIT_MODAL</code> dialog blocks all top-level windows run 0N/A * from the same toolkit except those from its own child hierarchy. If there 0N/A * are several applets launched in a browser, all of them run with the same 0N/A * toolkit; thus, a toolkit-modal dialog displayed by an applet may affect 0N/A * other applets and all windows of the browser instance which embeds the 0N/A * Java runtime environment for this toolkit. 0N/A * Special <code>AWTPermission</code> "toolkitModality" must be granted to use 0N/A * toolkit-modal dialogs. If a <code>TOOLKIT_MODAL</code> dialog is being created 0N/A * and this permission is not granted, a <code>SecurityException</code> will be 0N/A * thrown, and no dialog will be created. If a modality type is being changed 0N/A * to <code>TOOLKIT_MODAL</code> and this permission is not granted, a 0N/A * <code>SecurityException</code> will be thrown, and the modality type will 0N/A * be left unchanged. 0N/A * Default modality type for modal dialogs. The default modality type is 0N/A * <code>APPLICATION_MODAL</code>. Calling the oldstyle <code>setModal(true)</code> 0N/A * is equal to <code>setModalityType(DEFAULT_MODALITY_TYPE)</code>. 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog#setModal 0N/A * True if this dialog is modal, false is the dialog is modeless. 0N/A * A modal dialog blocks user input to some application top-level 0N/A * windows. This field is kept only for backwards compatibility. Use the 0N/A * {@link Dialog.ModalityType ModalityType} enum instead. 0N/A * @see #getModalityType 0N/A * @see #setModalityType 0N/A * @see ModalityType#MODELESS 0N/A * @see #DEFAULT_MODALITY_TYPE 0N/A * Modality type of this dialog. If the dialog's modality type is not 0N/A * {@link Dialog.ModalityType#MODELESS ModalityType.MODELESS}, it blocks all 0N/A * user input to some application top-level windows. 0N/A * @see #getModalityType 0N/A * @see #setModalityType 0N/A * Any top-level window can be marked not to be blocked by modal 0N/A * dialogs. This is called "modal exclusion". This enum specifies 0N/A * the possible modal exclusion types. 0N/A * @see Window#getModalExclusionType 0N/A * @see Window#setModalExclusionType 0N/A * @see Toolkit#isModalExclusionTypeSupported 0N/A * No modal exclusion. 0N/A * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window 0N/A * won't be blocked by any application-modal dialogs. Also, it isn't 0N/A * blocked by document-modal dialogs from outside of its child hierarchy. 0N/A * <code>TOOLKIT_EXCLUDE</code> indicates that a top-level window 0N/A * won't be blocked by application-modal or toolkit-modal dialogs. Also, 0N/A * it isn't blocked by document-modal dialogs from outside of its 0N/A * The "toolkitModality" <code>AWTPermission</code> must be granted 0N/A * for this exclusion. If an exclusion property is being changed to 0N/A * <code>TOOLKIT_EXCLUDE</code> and this permission is not granted, a 0N/A * <code>SecurityEcxeption</code> will be thrown, and the exclusion 0N/A * property will be left unchanged. 0N/A /* operations with this list should be synchronized on tree lock*/ 0N/A * Specifies the title of the Dialog. 0N/A * This field can be null. 0N/A * @see #setTitle(String) 0N/A * Indicates that this dialog is being hidden. This flag is set to true at 0N/A * the beginning of hide() and to false at the end of hide(). 0N/A * @see #hideAndDisposePreHandler() 0N/A * @see #hideAndDisposeHandler() 0N/A * @see #shouldBlock() 0N/A * Indicates that this dialog is being disposed. This flag is set to true at 0N/A * the beginning of doDispose() and to false at the end of doDispose(). 0N/A * @see #hideAndDisposePreHandler() 0N/A * @see #hideAndDisposeHandler() 0N/A * JDK 1.1 serialVersionUID 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> with 0N/A * the specified owner <code>Frame</code> and an empty title. 0N/A * @param owner the owner of the dialog or <code>null</code> if 0N/A * this dialog has no owner 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see Component#setSize 0N/A * @see Component#setVisible 0N/A * Constructs an initially invisible <code>Dialog</code> with the specified 0N/A * owner <code>Frame</code> and modality and an empty title. 0N/A * @param owner the owner of the dialog or <code>null</code> if 0N/A * this dialog has no owner 0N/A * @param modal specifes whether dialog blocks user input to other top-level 0N/A * windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>; 0N/A * if <code>true</code>, the modality type property is set to 0N/A * <code>DEFAULT_MODALITY_TYPE</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> with 0N/A * the specified owner <code>Frame</code> and title. 0N/A * @param owner the owner of the dialog or <code>null</code> if 0N/A * this dialog has no owner 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @exception IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see Component#setSize 0N/A * @see Component#setVisible 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Frame</code>, title and modality. 0N/A * @param owner the owner of the dialog or <code>null</code> if 0N/A * this dialog has no owner 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @param modal specifes whether dialog blocks user input to other top-level 0N/A * windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>; 0N/A * if <code>true</code>, the modality type property is set to 0N/A * <code>DEFAULT_MODALITY_TYPE</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see Component#setSize 0N/A * @see Component#setVisible 0N/A * Constructs an initially invisible <code>Dialog</code> with the specified owner 0N/A * <code>Frame</code>, title, modality, and <code>GraphicsConfiguration</code>. 0N/A * @param owner the owner of the dialog or <code>null</code> if this dialog 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @param modal specifes whether dialog blocks user input to other top-level 0N/A * windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>; 0N/A * if <code>true</code>, the modality type property is set to 0N/A * <code>DEFAULT_MODALITY_TYPE</code> 0N/A * @param gc the <code>GraphicsConfiguration</code> of the target screen device; 0N/A * if <code>null</code>, the default system <code>GraphicsConfiguration</code> 0N/A * @exception java.lang.IllegalArgumentException if <code>gc</code> 0N/A * is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see Component#setSize 0N/A * @see Component#setVisible 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> with 0N/A * the specified owner <code>Dialog</code> and an empty title. 0N/A * @param owner the owner of the dialog or <code>null</code> if this 0N/A * dialog has no owner 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> 0N/A * with the specified owner <code>Dialog</code> and title. 0N/A * @param owner the owner of the dialog or <code>null</code> if this 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Dialog</code>, title, and modality. 0N/A * @param owner the owner of the dialog or <code>null</code> if this 0N/A * dialog has no owner 0N/A * @param title the title of the dialog or <code>null</code> if this 0N/A * dialog has no title 0N/A * @param modal specifes whether dialog blocks user input to other top-level 0N/A * windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>; 0N/A * if <code>true</code>, the modality type property is set to 0N/A * <code>DEFAULT_MODALITY_TYPE</code> 0N/A * @exception IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Dialog</code>, title, modality and 0N/A * <code>GraphicsConfiguration</code>. 0N/A * @param owner the owner of the dialog or <code>null</code> if this 0N/A * dialog has no owner 0N/A * @param title the title of the dialog or <code>null</code> if this 0N/A * dialog has no title 0N/A * @param modal specifes whether dialog blocks user input to other top-level 0N/A * windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>; 0N/A * if <code>true</code>, the modality type property is set to 0N/A * <code>DEFAULT_MODALITY_TYPE</code> 0N/A * @param gc the <code>GraphicsConfiguration</code> of the target screen device; 0N/A * if <code>null</code>, the default system <code>GraphicsConfiguration</code> 0N/A * @exception java.lang.IllegalArgumentException if <code>gc</code> 0N/A * is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see Component#setSize 0N/A * @see Component#setVisible 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> with the 0N/A * specified owner <code>Window</code> and an empty title. 0N/A * @param owner the owner of the dialog. The owner must be an instance of 0N/A * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any 0N/A * of their descendents or <code>null</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code> 0N/A * is not an instance of {@link java.awt.Dialog Dialog} or {@link 0N/A * java.awt.Frame Frame} 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible, modeless <code>Dialog</code> with 0N/A * the specified owner <code>Window</code> and title. 0N/A * @param owner the owner of the dialog. The owner must be an instance of 0N/A * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any 0N/A * of their descendents or <code>null</code> 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code> 0N/A * is not an instance of {@link java.awt.Dialog Dialog} or {@link 0N/A * java.awt.Frame Frame} 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Window</code> and modality and an empty title. 0N/A * @param owner the owner of the dialog. The owner must be an instance of 0N/A * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any 0N/A * of their descendents or <code>null</code> 0N/A * @param modalityType specifies whether dialog blocks input to other 0N/A * windows when shown. <code>null</code> value and unsupported modality 0N/A * types are equivalent to <code>MODELESS</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code> 0N/A * is not an instance of {@link java.awt.Dialog Dialog} or {@link 0N/A * java.awt.Frame Frame} 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @exception SecurityException if the calling thread does not have permission 0N/A * to create modal dialogs with the given <code>modalityType</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see java.awt.Toolkit#isModalityTypeSupported 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Window</code>, title and modality. 0N/A * @param owner the owner of the dialog. The owner must be an instance of 0N/A * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any 0N/A * of their descendents or <code>null</code> 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @param modalityType specifies whether dialog blocks input to other 0N/A * windows when shown. <code>null</code> value and unsupported modality 0N/A * types are equivalent to <code>MODELESS</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code> 0N/A * is not an instance of {@link java.awt.Dialog Dialog} or {@link 0N/A * java.awt.Frame Frame} 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code>'s 0N/A * <code>GraphicsConfiguration</code> is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @exception SecurityException if the calling thread does not have permission 0N/A * to create modal dialogs with the given <code>modalityType</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see java.awt.Toolkit#isModalityTypeSupported 0N/A * Constructs an initially invisible <code>Dialog</code> with the 0N/A * specified owner <code>Window</code>, title, modality and 0N/A * <code>GraphicsConfiguration</code>. 0N/A * @param owner the owner of the dialog. The owner must be an instance of 0N/A * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any 0N/A * of their descendents or <code>null</code> 0N/A * @param title the title of the dialog or <code>null</code> if this dialog 0N/A * @param modalityType specifies whether dialog blocks input to other 0N/A * windows when shown. <code>null</code> value and unsupported modality 0N/A * types are equivalent to <code>MODELESS</code> 0N/A * @param gc the <code>GraphicsConfiguration</code> of the target screen device; 0N/A * if <code>null</code>, the default system <code>GraphicsConfiguration</code> 0N/A * @exception java.lang.IllegalArgumentException if the <code>owner</code> 0N/A * is not an instance of {@link java.awt.Dialog Dialog} or {@link 0N/A * java.awt.Frame Frame} 0N/A * @exception java.lang.IllegalArgumentException if <code>gc</code> 0N/A * is not from a screen device 0N/A * @exception HeadlessException when 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code> 0N/A * @exception SecurityException if the calling thread does not have permission 0N/A * to create modal dialogs with the given <code>modalityType</code> 0N/A * @see java.awt.Dialog.ModalityType 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#setModalityType 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see java.awt.Toolkit#isModalityTypeSupported 0N/A * Construct a name for this component. Called by getName() when the 0N/A * Makes this Dialog displayable by connecting it to 0N/A * a native screen resource. Making a dialog displayable will 0N/A * cause any of its children to be made displayable. 0N/A * This method is called internally by the toolkit and should 0N/A * not be called directly by programs. 0N/A * @see Component#isDisplayable 0N/A * @see #removeNotify 0N/A * Indicates whether the dialog is modal. 0N/A * This method is obsolete and is kept for backwards compatiblity only. 0N/A * Use {@link #getModalityType getModalityType()} instead. 0N/A * @return <code>true</code> if this dialog window is modal; 0N/A * <code>false</code> otherwise 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#setModal 0N/A * @see java.awt.Dialog#getModalityType 0N/A * @see java.awt.Dialog#setModalityType 0N/A * Specifies whether this dialog should be modal. 0N/A * This method is obsolete and is kept for backwards compatibility only. 0N/A * Use {@link #setModalityType setModalityType()} instead. 0N/A * Note: changing modality of the visible dialog may have no effect 0N/A * until it is hidden and then shown again. 0N/A * @param modal specifies whether dialog blocks input to other windows 0N/A * when shown; calling to <code>setModal(true)</code> is equivalent to 0N/A * <code>setModalityType(Dialog.DEFAULT_MODALITY_TYPE)</code>, and 0N/A * calling to <code>setModal(false)</code> is equvivalent to 0N/A * <code>setModalityType(Dialog.ModalityType.MODELESS)</code> 0N/A * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE 0N/A * @see java.awt.Dialog.ModalityType#MODELESS 0N/A * @see java.awt.Dialog#isModal 0N/A * @see java.awt.Dialog#getModalityType 0N/A * @see java.awt.Dialog#setModalityType 0N/A * Returns the modality type of this dialog. 0N/A * @return modality type of this dialog 0N/A * @see java.awt.Dialog#setModalityType 0N/A * Sets the modality type for this dialog. See {@link 0N/A * java.awt.Dialog.ModalityType ModalityType} for possible modality types. 0N/A * If the given modality type is not supported, <code>MODELESS</code> 0N/A * is used. You may want to call <code>getModalityType()</code> after calling 0N/A * this method to ensure that the modality type has been set. 0N/A * Note: changing modality of the visible dialog may have no effect 0N/A * until it is hidden and then shown again. 0N/A * @param type specifies whether dialog blocks input to other 0N/A * windows when shown. <code>null</code> value and unsupported modality 0N/A * types are equivalent to <code>MODELESS</code> 0N/A * @exception SecurityException if the calling thread does not have permission 0N/A * to create modal dialogs with the given <code>modalityType</code> 0N/A * @see java.awt.Dialog#getModalityType 0N/A * @see java.awt.Toolkit#isModalityTypeSupported 0N/A * Gets the title of the dialog. The title is displayed in the 0N/A * @return the title of this dialog window. The title may be 0N/A * <code>null</code>. 0N/A * @see java.awt.Dialog#setTitle 0N/A * Sets the title of the Dialog. 0N/A * @param title the title displayed in the dialog's border; 0N/A * a null value results in an empty title 0N/A synchronized(
this) {
0N/A * @return true if we actually showed, false if we just called toFront() 0N/A // check if this dialog should be modal blocked BEFORE calling peer.show(), 0N/A // otherwise, a pair of FOCUS_GAINED and FOCUS_LOST may be mistakenly 0N/A // generated for the dialog 0N/A // keep the KeyEvents from being dispatched 0N/A // until the focus has been transfered 0N/A // This call is required as the show() method of the Dialog class 0N/A // does not invoke the super.show(). So wried... :( 0N/A * Shows or hides this {@code Dialog} depending on the value of parameter 0N/A * @param b if {@code true}, makes the {@code Dialog} visible, 0N/A * otherwise hides the {@code Dialog}. 0N/A * are not yet displayable, both are made displayable. The 0N/A * dialog will be validated prior to being made visible. 0N/A * If {@code false}, hides the {@code Dialog} and then causes {@code setVisible(true)} 0N/A * to return if it is currently blocked. 0N/A * <b>Notes for modal dialogs</b>. 0N/A * <li>{@code setVisible(true)}: If the dialog is not already 0N/A * visible, this call will not return until the dialog is 0N/A * hidden by calling {@code setVisible(false)} or 0N/A * <li>{@code setVisible(false)}: Hides the dialog and then 0N/A * returns on {@code setVisible(true)} if it is currently blocked. 0N/A * <li>It is OK to call this method from the event dispatching 0N/A * thread because the toolkit ensures that other events are 0N/A * not blocked while this method is blocked. 0N/A * @see java.awt.Window#setVisible 0N/A * @see java.awt.Window#dispose 0N/A * @see java.awt.Component#isDisplayable 0N/A * @see java.awt.Component#validate 0N/A * @see java.awt.Dialog#isModal 0N/A * Stores the app context on which event dispatch thread the dialog 0N/A * is being shown. Initialized in show(), used in hideAndDisposeHandler() 0N/A * Makes the {@code Dialog} visible. If the dialog and/or its owner 0N/A * are not yet displayable, both are made displayable. The 0N/A * dialog will be validated prior to being made visible. 0N/A * If the dialog is already visible, this will bring the dialog 0N/A * If the dialog is modal and is not already visible, this call 0N/A * will not return until the dialog is hidden by calling hide or 0N/A * dispose. It is permissible to show modal dialogs from the event 0N/A * dispatching thread because the toolkit will ensure that another 0N/A * event pump runs while the one which invoked this method is blocked. 0N/A * @see Component#hide 0N/A * @see Component#isDisplayable 0N/A * @see Component#validate 0N/A * @see Window#setVisible(boolean) 0N/A * @deprecated As of JDK version 1.5, replaced by 0N/A * {@link #setVisible(boolean) setVisible(boolean)}. 0N/A // Set this variable before calling conditionalShow(). That 0N/A // way, if the Dialog is hidden right after being shown, we 0N/A // won't mistakenly block this thread. 0N/A // Store the app context on which this dialog is being shown. 0N/A // Event dispatch thread of this app context will be sleeping until 0N/A // we wake it by any event from hideAndDisposeHandler(). 0N/A // We have two mechanisms for blocking: 1. If we're on the 0N/A // EventDispatchThread, start a new event pump. 2. If we're 0N/A // on any other thread, call wait() on the treelock. 0N/A // if this dialog is toolkit-modal, the filter should be added 0N/A // to all EDTs (for all AppContexts) 0N/A // it may occur that EDT for appContext hasn't been started yet, so 0N/A // we post an empty invocation event to trigger EDT initialization 0N/A * dispose SequencedEvent we are dispatching on current 0N/A * AppContext, to prevent us from hang. 0N/A // BugId 4531693 (son@sparc.spb.su) 0N/A * Event processing is done inside doPrivileged block so that 0N/A * it wouldn't matter even if user code is on the stack 0N/A * Fix for BugId 6300270 0N/A // if this dialog is toolkit-modal, its filter must be removed 0N/A // from all EDTs (for all AppContexts) 0N/A // Restore normal key event dispatching 0N/A // dialog can be shown and then disposed before its 0N/A // modal filter is created 0N/A // Wake up event dispatch thread on which the dialog was 0N/A * Hides the Dialog and then causes {@code show} to return if it is currently 0N/A * @see Window#dispose 0N/A * @see Window#setVisible(boolean) 0N/A * @deprecated As of JDK version 1.5, replaced by 0N/A * {@link #setVisible(boolean) setVisible(boolean)}. 0N/A // fix for 5048370: if hide() is called from super.doDispose(), then 0N/A // hideAndDisposeHandler() should not be called here as it will be called 0N/A // at the end of doDispose() 0N/A * Disposes the Dialog and then causes show() to return if it is currently 0N/A // fix for 5048370: set isInDispose flag to true to prevent calling 0N/A // to hideAndDisposeHandler() from hide() 0N/A * If this dialog is modal and blocks some windows, then all of them are 0N/A * also sent to the back to keep them below the blocking dialog. 0N/A * @see java.awt.Window#toBack 0N/A * Indicates whether this dialog is resizable by the user. 0N/A * By default, all dialogs are initially resizable. 0N/A * @return <code>true</code> if the user can resize the dialog; 0N/A * <code>false</code> otherwise. 0N/A * @see java.awt.Dialog#setResizable 0N/A * Sets whether this dialog is resizable by the user. 0N/A * @param resizable <code>true</code> if the user can 0N/A * resize this dialog; <code>false</code> otherwise. 0N/A * @see java.awt.Dialog#isResizable 0N/A synchronized (
this) {
0N/A // On some platforms, changing the resizable state affects 0N/A // the insets of the Dialog. If we could, we'd call invalidate() 0N/A // from the peer, but we need to guarantee that we're not holding 0N/A // the Dialog lock when we call invalidate(). 0N/A * Disables or enables decorations for this dialog. 0N/A * This method can only be called while the dialog is not displayable. 0N/A * @param undecorated <code>true</code> if no dialog decorations are 0N/A * <code>false</code> if dialog decorations are to be enabled. 0N/A * @throws <code>IllegalComponentStateException</code> if the dialog 0N/A * @see #isUndecorated 0N/A * @see Component#isDisplayable 0N/A /* Make sure we don't run in the middle of peer creation.*/ 0N/A * Indicates whether this dialog is undecorated. 0N/A * By default, all dialogs are initially decorated. 0N/A * @return <code>true</code> if dialog is undecorated; 0N/A * <code>false</code> otherwise. 0N/A * @see java.awt.Dialog#setUndecorated 0N/A * Returns a string representing the state of this dialog. This 0N/A * method is intended to be used only for debugging purposes, and the 0N/A * content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not be 0N/A * <code>null</code>. 0N/A * @return the parameter string of this dialog window. 0N/A * Initialize JNI field and method IDs 0N/A * --- Modality support --- 0N/A * This method is called only for modal dialogs. 0N/A * Goes through the list of all visible top-level windows and 0N/A * divide them into three distinct groups: blockers of this dialog, 0N/A * blocked by this dialog and all others. Then blocks this dialog 0N/A * by first met dialog from the first group (if any) and blocks all 0N/A * the windows from the second group. 0N/A // find all the dialogs that block this one 0N/A while ((w !=
null) && (w !=
this)) {
0N/A // add all blockers' blockers to blockers :) 0N/A // find all windows from blockers' hierarchies 0N/A // block all windows from scope of blocking except from blockers' hierarchies 0N/A * This method is called only for modal dialogs. 0N/A * Unblocks all the windows blocked by this modal dialog. After 0N/A * each of them has been unblocked, it is checked to be blocked by 0N/A * any other modal dialogs. 0N/A // we should unblock all the windows first... 0N/A // ... and only after that check if they should be blocked 0N/A // by another dialogs 0N/A * Returns whether the given top-level window should be blocked by 0N/A * this dialog. Note, that the given window can be also a modal dialog 0N/A * and it should block this dialog, but this method do not take such 0N/A * situations into consideration (such checks are performed in the 0N/A * modalShow() and modalHide() methods). 0N/A * This method should be called on the getTreeLock() lock. 0N/A // check if w is from children hierarchy 0N/A // fix for 6271546: we should also take into consideration child hierarchies 0N/A // of this dialog's blockers 0N/A // application- and toolkit-excluded windows are not blocked by 0N/A // document-modal dialogs from outside their children hierarchy 0N/A * Adds the given top-level window to the list of blocked 0N/A * windows for this dialog and marks it as modal blocked. 0N/A * If the window is already blocked by some modal dialog, 0N/A * Removes the given top-level window from the list of blocked 0N/A * windows for this dialog and marks it as unblocked. If the 0N/A * window is not modal blocked, does nothing. 0N/A * Checks if any other modal dialog D blocks the given window. 0N/A * If such D exists, mark the window as blocked by D. 0N/A // in 1.5 or earlier modalityType was absent, so use "modal" instead 0N/A * --- Accessibility Support --- 0N/A * Gets the AccessibleContext associated with this Dialog. 0N/A * For dialogs, the AccessibleContext takes the form of an 0N/A * AccessibleAWTDialog. 0N/A * A new AccessibleAWTDialog instance is created if necessary. 0N/A * @return an AccessibleAWTDialog that serves as the 0N/A * AccessibleContext of this Dialog 0N/A * This class implements accessibility support for the 0N/A * <code>Dialog</code> class. It provides an implementation of the 0N/A * Java Accessibility API appropriate to dialog user-interface elements. 0N/A * JDK 1.3 serialVersionUID 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * @see AccessibleRole 0N/A * Get the state of this object. 0N/A * @return an instance of AccessibleStateSet containing the current 0N/A * state set of the object 0N/A * @see AccessibleState 0N/A }
// inner class AccessibleAWTDialog