src/share/classes/java/awt/Dialog.java

Print this page




 653      * @see java.awt.Dialog.ModalityType
 654      * @see java.awt.Dialog#setModal
 655      * @see java.awt.Dialog#setModalityType
 656      * @see java.awt.GraphicsEnvironment#isHeadless
 657      * @see java.awt.Toolkit#isModalityTypeSupported
 658      *
 659      * @since 1.6
 660      */
 661     public Dialog(Window owner, String title, ModalityType modalityType) {
 662         super(owner);
 663 
 664         if ((owner != null) &&
 665             !(owner instanceof Frame) &&
 666             !(owner instanceof Dialog))
 667         {
 668             throw new IllegalArgumentException("Wrong parent window");
 669         }
 670 
 671         this.title = title;
 672         setModalityType(modalityType);
 673         SunToolkit.checkAndSetPolicy(this, false);
 674     }
 675 
 676     /**
 677      * Constructs an initially invisible <code>Dialog</code> with the
 678      * specified owner <code>Window</code>, title, modality and
 679      * <code>GraphicsConfiguration</code>.
 680      *
 681      * @param owner the owner of the dialog. The owner must be an instance of
 682      *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 683      *     of their descendents or <code>null</code>
 684      * @param title the title of the dialog or <code>null</code> if this dialog
 685      *     has no title
 686      * @param modalityType specifies whether dialog blocks input to other
 687      *    windows when shown. <code>null</code> value and unsupported modality
 688      *    types are equivalent to <code>MODELESS</code>
 689      * @param gc the <code>GraphicsConfiguration</code> of the target screen device;
 690      *     if <code>null</code>, the default system <code>GraphicsConfiguration</code>
 691      *     is assumed
 692      *
 693      * @exception java.lang.IllegalArgumentException if the <code>owner</code>


 704      * @see java.awt.Dialog#setModal
 705      * @see java.awt.Dialog#setModalityType
 706      * @see java.awt.GraphicsEnvironment#isHeadless
 707      * @see java.awt.Toolkit#isModalityTypeSupported
 708      *
 709      * @since 1.6
 710      */
 711     public Dialog(Window owner, String title, ModalityType modalityType,
 712                   GraphicsConfiguration gc) {
 713         super(owner, gc);
 714 
 715         if ((owner != null) &&
 716             !(owner instanceof Frame) &&
 717             !(owner instanceof Dialog))
 718         {
 719             throw new IllegalArgumentException("wrong owner window");
 720         }
 721 
 722         this.title = title;
 723         setModalityType(modalityType);
 724         SunToolkit.checkAndSetPolicy(this, false);
 725     }
 726 
 727     /**
 728      * Construct a name for this component.  Called by getName() when the
 729      * name is null.
 730      */
 731     String constructComponentName() {
 732         synchronized (Dialog.class) {
 733             return base + nameCounter++;
 734         }
 735     }
 736 
 737     /**
 738      * Makes this Dialog displayable by connecting it to
 739      * a native screen resource.  Making a dialog displayable will
 740      * cause any of its children to be made displayable.
 741      * This method is called internally by the toolkit and should
 742      * not be called directly by programs.
 743      * @see Component#isDisplayable
 744      * @see #removeNotify




 653      * @see java.awt.Dialog.ModalityType
 654      * @see java.awt.Dialog#setModal
 655      * @see java.awt.Dialog#setModalityType
 656      * @see java.awt.GraphicsEnvironment#isHeadless
 657      * @see java.awt.Toolkit#isModalityTypeSupported
 658      *
 659      * @since 1.6
 660      */
 661     public Dialog(Window owner, String title, ModalityType modalityType) {
 662         super(owner);
 663 
 664         if ((owner != null) &&
 665             !(owner instanceof Frame) &&
 666             !(owner instanceof Dialog))
 667         {
 668             throw new IllegalArgumentException("Wrong parent window");
 669         }
 670 
 671         this.title = title;
 672         setModalityType(modalityType);
 673         SunToolkit.checkAndSetPolicy(this);
 674     }
 675 
 676     /**
 677      * Constructs an initially invisible <code>Dialog</code> with the
 678      * specified owner <code>Window</code>, title, modality and
 679      * <code>GraphicsConfiguration</code>.
 680      *
 681      * @param owner the owner of the dialog. The owner must be an instance of
 682      *     {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
 683      *     of their descendents or <code>null</code>
 684      * @param title the title of the dialog or <code>null</code> if this dialog
 685      *     has no title
 686      * @param modalityType specifies whether dialog blocks input to other
 687      *    windows when shown. <code>null</code> value and unsupported modality
 688      *    types are equivalent to <code>MODELESS</code>
 689      * @param gc the <code>GraphicsConfiguration</code> of the target screen device;
 690      *     if <code>null</code>, the default system <code>GraphicsConfiguration</code>
 691      *     is assumed
 692      *
 693      * @exception java.lang.IllegalArgumentException if the <code>owner</code>


 704      * @see java.awt.Dialog#setModal
 705      * @see java.awt.Dialog#setModalityType
 706      * @see java.awt.GraphicsEnvironment#isHeadless
 707      * @see java.awt.Toolkit#isModalityTypeSupported
 708      *
 709      * @since 1.6
 710      */
 711     public Dialog(Window owner, String title, ModalityType modalityType,
 712                   GraphicsConfiguration gc) {
 713         super(owner, gc);
 714 
 715         if ((owner != null) &&
 716             !(owner instanceof Frame) &&
 717             !(owner instanceof Dialog))
 718         {
 719             throw new IllegalArgumentException("wrong owner window");
 720         }
 721 
 722         this.title = title;
 723         setModalityType(modalityType);
 724         SunToolkit.checkAndSetPolicy(this);
 725     }
 726 
 727     /**
 728      * Construct a name for this component.  Called by getName() when the
 729      * name is null.
 730      */
 731     String constructComponentName() {
 732         synchronized (Dialog.class) {
 733             return base + nameCounter++;
 734         }
 735     }
 736 
 737     /**
 738      * Makes this Dialog displayable by connecting it to
 739      * a native screen resource.  Making a dialog displayable will
 740      * cause any of its children to be made displayable.
 741      * This method is called internally by the toolkit and should
 742      * not be called directly by programs.
 743      * @see Component#isDisplayable
 744      * @see #removeNotify