< prev index next >

src/java.desktop/share/classes/java/awt/doc-files/Modality.html

Print this page








   1 <!--
   2  Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
   3  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 
   5  This code is free software; you can redistribute it and/or modify it
   6  under the terms of the GNU General Public License version 2 only, as
   7  published by the Free Software Foundation.  Oracle designates this
   8  particular file as subject to the "Classpath" exception as provided
   9  by Oracle in the LICENSE file that accompanied this code.
  10 
  11  This code is distributed in the hope that it will be useful, but WITHOUT
  12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  version 2 for more details (a copy is included in the LICENSE file that
  15  accompanied this code).
  16 
  17  You should have received a copy of the GNU General Public License version
  18  2 along with this work; if not, write to the Free Software Foundation,
  19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 
  21  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  or visit www.oracle.com if you need additional information or have any
  23  questions.
  24 -->
  25 
  26 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  27 
  28 <html>
  29 
  30 <head>
  31 
  32     <title>The AWT Modality</title>
  33 
  34 </head>
  35 
  36 <body bgcolor="white">
  37 
  38     <h1 align="center">The AWT Modality</h1>
  39 
  40     <p>
  41       This document, together with the API documentation for modality-related
  42       classes (such as <code>java.awt.Dialog</code>), briefly describes the new
  43       modality features and how to use them. It contains the following sections:
  44     </p><ul>
  45       <li><a href="#Definitions">Definitions</a></li>
  46       <li><a href="#ModalityTypes">Modality types</a></li>
  47       <li><a href="#ShowHideBlocking">Show/hide blocking</a></li>
  48       <li><a href="#ModalExclusion">Modal exclusion</a></li>
  49       <li><a href="#Related">Related AWT features</a></li>
  50       <li><a href="#Security">Security</a></li>
  51       <li><a href="#PlatformSupport">Platform support</a></li>
  52       <li><a href="#Compatibility">Compatibility</a></li>
  53       <li><a href="#Examples">Examples</a></li>
  54     </ul>
  55 
  56     <a name="Definitions"></a>
  57     <h3>Definitions</h3>
  58 
  59     <p>
  60       <u>Document</u> - a window without an owner that, together with
  61       all its child hierarchy, may be operated on as a single self-contained
  62       document.
  63       Every window belongs to some document &mdash; its root can be found as
  64       the closest ancestor window without an owner.
  65     </p><p>
  66       <a name="ModalBlocked"></a>
  67       <u>Modal blocked window</u> - a window, that:
  68       </p><ul>
  69         <li>doesn't receive any user input events
  70         </li><li>doesn't receive input focus
  71         </li><li>keeps its Z-order below the modal dialog that blocks it
  72       </li></ul>
  73       <blockquote>
  74         <hr>
  75           <b>Warning!</b> Some window managers allow users to change the window
  76           Z-order in an arbitrary way &mdash; in that case the last requirement 
  77           may not be met.
  78         <hr>
  79       </blockquote>
  80     <p>
  81       <u>Modal dialog</u> - a dialog that blocks some windows while it is
  82       visible. The blocked windows are determined according to the dialog's
  83       scope of blocking.
  84     </p><p>
  85       <u>Modal excluded window</u> - a window that stays unblocked
  86       while the modal dialog is visible. If a window is modal excluded
  87       then all its owned windows and child components are also excluded.
  88     </p><p>
  89       <u>Scope of blocking (SB)</u> - the set of windows (instances of
  90       <code>java.awt.Window</code> and all derived classes) that are blocked by 
  91       the modal dialog while it is visible.
  92      <blockquote><hr>
  93       <b>Note</b>: Everywhere in this document the notion of "window" is equal
  94       to a top-level window in the Java programming language &mdash; in other words
  95       an instance of <code>java.awt.Window</code> or any descendant class.
  96       <hr></blockquote>
  97 
  98     <a name="ModalityTypes"></a>
  99     <h3>Modality types</h3>
 100 
 101     <p>
 102       There are four supported modality types :
 103       </p><ul>
 104         <li>toolkit
 105         </li><li>application
 106         </li><li>document
 107         </li><li>modeless
 108       </li></ul>
 109       A dialog is, by default, modeless.  A modal dialog is, by default,
 110       application-modal.
 111     <ol>
 112       <li><u>Modeless dialogs</u><br>
 113         A modeless dialog doesn't block any windows while visible.
 114       </li><li><u>Document-modal dialogs</u><br>
 115         A document-modal dialog blocks all windows from the same
 116         document except those from its child hierarchy. The document root
 117         is determined as the closest ancestor window without an
 118         owner.


 142       Notes about owners:
 143       </p><ul>
 144         <li>Creating a document-modal dialog without an owner:<br>
 145           Since <code>Dialog</code> is a class derived from
 146           <code>Window</code>, a <code>Dialog</code> instance automatically
 147           becomes the root of the document if it has no owner. Thus, if
 148           such a dialog is document-modal, its scope of blocking is empty
 149           and it behaves the same way as a modeless dialog.
 150         </li><li>Creating an application-modal or toolkit-modal dialog with an
 151           owner:<br>
 152           The scope of blocking for an application- or toolkit-modal
 153           dialog, as opposed to a document-modal dialog, doesn't depend on
 154           its owner. Thus, in this case the only thing that the owner
 155           affects is the Z-order: the dialog always stays on top of its owner.
 156       </li></ul>
 157     <blockquote><hr>
 158       <b>Implementation note</b>: Changing the modality type for a visible
 159       dialog may have no effect until it is hidden and then shown again.
 160       <hr></blockquote>
 161 
 162     <a name="ShowHideBlocking"></a>
 163     <h3>Show/hide blocking</h3>
 164 
 165     <p>
 166       <u>Showing the window or modeless dialog: "F"</u><br>
 167       All the visible modal dialogs are looked through &mdash; if F is from the SB
 168       of one of them, it becomes blocked by it. If there are several such
 169       dialogs, the first shown is used. If no such dialogs exist, F remains
 170       unblocked.
 171     </p><p>
 172       <u>Showing the modal dialog: "M"</u><br>
 173       When modal dialog M is shown, all the visible windows fall into one of
 174       three distinct groups: 
 175       <ul>
 176       <li>Blockers of M (modal dialogs that block M and
 177       either are in M's child hierarchy, or are not blocked by M, or have
 178       a greater mode of modality, or block some other blocker of M)
 179       <li>Blocked by M (windows from M's SB that are not blockers and are
 180       not in child hierarchy of any blocker)
 181       <li>All other windows (windows or modeless
 182       dialogs outside M's SB and modal dialogs outside M's SB that do not


 247               <td align="center">-</td>
 248             </tr>
 249           </tbody></table>
 250 <!--        </center> -->
 251       <p>
 252       After the modal dialog is shown, all the windows from its SB are blocked,
 253       except those that block this modal dialog.
 254     </p><p>
 255       <u>Hiding the window or modeless dialog: "F"</u><br>
 256       If F was blocked by any modal dialog M, it becomes unblocked and is
 257       removed from M's blocked windows list.
 258     </p><p>
 259       <u>Hiding the modal dialog: "M"</u><br>
 260       If M was blocked by any other modal dialog, for example, "N",
 261       it becomes unblocked and
 262       is removed from N's blocked windows list. Then, all the windows and dialogs
 263       blocked by M become unblocked, and after that the same checks 
 264       (as in Showing the modal dialog: "M")
 265       are performed for each of them in the order they were initially shown.
 266 
 267     <a name="ModalExclusion"></a>
 268     </p><h3>Modal exclusion</h3>
 269 
 270     <p>
 271       There are two modal exclusion types introduced as of JDK 6
 272       </p><ul>
 273         <li>Exclusion from blocking of toolkit-modal dialogs
 274         </li><li>Exclusion from blocking of application-modal dialogs
 275       </li></ul>
 276       By default, a window's modal exclusion property is turned off.
 277       <ol>
 278         <li><u>Application-modal exclusion</u><br>
 279           If a window is application-modal excluded, it is not blocked by any
 280           application-modal dialogs. Also, it is not blocked by document-modal
 281           dialogs from outside of its child hierarchy.
 282         </li><li><u>Toolkit-modal exclusion</u><br>
 283           If a window is toolkit-modal excluded, it is not blocked
 284           by any application- or toolkit-modal dialogs. Also, it is not
 285           blocked by document-modal dialogs from outside of their child hierarchy.
 286       </li></ol>
 287     <blockquote>
 288       <hr>
 289         <b>Implementation note</b>: Changing the modal exclusion type for a visible window
 290         may have no effect until it is hidden and then shown again.
 291     </blockquote>
 292 
 293     <a name="Related"></a>
 294     <h3>Related AWT features</h3>
 295 
 296     <p>
 297       <u>Always-On-Top</u><br>
 298       When a modal dialog that is not always-on-top blocks an always-on-top window,
 299       their relative Z-order is unspecified and platform-dependent.
 300     </p>
 301     <p>
 302       <u>The <code>toFront()</code> and <code>toBack()</code> methods</u><br>
 303       A modal dialog should always be above all its blocked windows. Thus, if a blocked
 304       window is brought to the front, its blocking dialog, if any, is also brought to the
 305       front and remains above the blocked window. Likewise, if a modal dialog is sent to
 306       the back, all of its blocked windows are sent to the back to keep them below the
 307       blocking dialog.
 308     </p>
 309     <p>
 310       <u>Minimizing, maximizing and closing blocked windows</u><br>
 311       When a modal dialog blocks a window, the user may not be able to maximize or
 312       minimize the blocked window&mdash; however, the actual behavior is unspecified
 313       and platform-dependent. In any case, the user can't close the blocked window


 317     </p>
 318     <p>
 319       <u>Blocked windows activations</u><br>
 320       When the user selects a blocked window, it may be brought to the front, along
 321       with the blocking modal dialog which would then become the active window&mdash;
 322       however, the actual behavior is unspecified and platform-dependent.
 323     </p>
 324     <p>
 325       <u>Hiding a modal dialog</u><br>
 326       When the modal dialog that currently has focus is hidden, it is unspecified
 327       and platform-dependent, which other window will become the active window.
 328       Any of the following may become the active window:
 329       <ol>
 330         <li>The owner of the modal dialog - if the owner is unblocked.
 331         </li><li>The <code>Window</code>, which was active before this modal dialog gained
 332         focus - if the owner of the modal dialog is absent or is blocked.
 333       </li></ol>
 334       If the modal dialog to be hidden does not have focus, the active window remains
 335       unchanged.
 336     
 337     <a name="Security"></a>
 338     <h3>Security</h3>
 339 
 340     <p>
 341       A special <code>AWTPermission</code>, <code>"toolkitModality"</code>,
 342       is required to show toolkit-modal
 343       dialogs. This would prevent, for example, blocking a browser or 
 344       Java Web Start (JWS) by modal dialogs shown from applets.
 345     </p><p>
 346       The same permission is required to exclude a window from toolkit modality.
 347       This would prevent, for example, a dialog shown from an applet not to be
 348       blocked by a browser's or JWS's modal dialog.
 349 
 350     <a name="PlatformSupport"></a>
 351     </p><h3>Platform support</h3>
 352 
 353     <p>
 354       Two <code>java.awt.Toolkit</code> methods allow you to check whether
 355       the current platform supports specific modality features:
 356       </p><ul>
 357         <li><code>isModalityTypeSupported(modalityType)</code><br>
 358           Returns whether the specified modality type is supported on
 359           the current platform.
 360           If mode "M" is not supported and a dialog is set to M-modal,
 361           it behaves as modeless.
 362         </li>
 363         <li><code>isModalExclusionTypeSupported(modalExclusionType)</code><br>
 364           Returns whether the given modal exclusion type is supported on
 365           the current platform. If exclusion type "E" is not supported
 366           and a window is marked as E-excluded, this has no effect.
 367       </li></ul>
 368 
 369     <a name="Compatibility"></a>
 370     <h3>Compatibility</h3>
 371 
 372     <p>
 373       The default modality type is application-modal. It is used by the API
 374       calls: <code>Dialog.setModal(true)</code>, 
 375       <code>Dialog(owner, true)</code>, etc. Prior to JDK 6
 376       the default type was toolkit-modal,
 377       but the only distinction between application- and toolkit-modality is for
 378       applets and applications launched from Java Web Start.
 379 
 380     <a name="Examples"></a>
 381     </p><h3>Examples</h3>
 382 
 383     <table border="0">
 384       <tbody><tr>
 385         <td align="left" >
 386         <ol>
 387           <li>Frame "F" is shown<br>
 388           <li>Document-modal dialog "D<sub>i</sub>" is shown<br>
 389           <li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
 390           <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
 391           <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's in the
 392               same document<br>
 393           </ol>
 394           <br>
 395         </td>
 396         <td align="center">
 397           <img src="modal-example1.gif" alt="Example 1">
 398           <br>
 399         </td>
 400       </tr>


   1 <!doctype html>
   2 <html lang="en">
   3 <head>
   4   <meta charset="utf-8"/>
   5   <title>The AWT Modality</title>
   6 </head>
   7 <!--
   8  Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
   9  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  10 
  11  This code is free software; you can redistribute it and/or modify it
  12  under the terms of the GNU General Public License version 2 only, as
  13  published by the Free Software Foundation.  Oracle designates this
  14  particular file as subject to the "Classpath" exception as provided
  15  by Oracle in the LICENSE file that accompanied this code.
  16 
  17  This code is distributed in the hope that it will be useful, but WITHOUT
  18  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  19  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  20  version 2 for more details (a copy is included in the LICENSE file that
  21  accompanied this code).
  22 
  23  You should have received a copy of the GNU General Public License version
  24  2 along with this work; if not, write to the Free Software Foundation,
  25  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  26 
  27  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  28  or visit www.oracle.com if you need additional information or have any
  29  questions.
  30 -->
  31 
  32 <body>










  33 
  34     <h1>The AWT Modality</h1>
  35 
  36     <p>
  37       This document, together with the API documentation for modality-related
  38       classes (such as <code>java.awt.Dialog</code>), briefly describes the new
  39       modality features and how to use them. It contains the following sections:
  40     </p><ul>
  41       <li><a href="#Definitions">Definitions</a></li>
  42       <li><a href="#ModalityTypes">Modality types</a></li>
  43       <li><a href="#ShowHideBlocking">Show/hide blocking</a></li>
  44       <li><a href="#ModalExclusion">Modal exclusion</a></li>
  45       <li><a href="#Related">Related AWT features</a></li>
  46       <li><a href="#Security">Security</a></li>
  47       <li><a href="#PlatformSupport">Platform support</a></li>
  48       <li><a href="#Compatibility">Compatibility</a></li>
  49       <li><a href="#Examples">Examples</a></li>
  50     </ul>
  51 
  52     <a id="Definitions"></a>
  53     <h3>Definitions</h3>
  54 
  55     <p>
  56       <u>Document</u> - a window without an owner that, together with
  57       all its child hierarchy, may be operated on as a single self-contained
  58       document.
  59       Every window belongs to some document &mdash; its root can be found as
  60       the closest ancestor window without an owner.
  61     </p><p>
  62       <a id="ModalBlocked"></a>
  63       <u>Modal blocked window</u> - a window, that:
  64       </p><ul>
  65         <li>doesn't receive any user input events
  66         </li><li>doesn't receive input focus
  67         </li><li>keeps its Z-order below the modal dialog that blocks it
  68       </li></ul>
  69       <blockquote>
  70         <hr>
  71           <b>Warning!</b> Some window managers allow users to change the window
  72           Z-order in an arbitrary way &mdash; in that case the last requirement
  73           may not be met.
  74         <hr>
  75       </blockquote>
  76     <p>
  77       <u>Modal dialog</u> - a dialog that blocks some windows while it is
  78       visible. The blocked windows are determined according to the dialog's
  79       scope of blocking.
  80     </p><p>
  81       <u>Modal excluded window</u> - a window that stays unblocked
  82       while the modal dialog is visible. If a window is modal excluded
  83       then all its owned windows and child components are also excluded.
  84     </p><p>
  85       <u>Scope of blocking (SB)</u> - the set of windows (instances of
  86       <code>java.awt.Window</code> and all derived classes) that are blocked by
  87       the modal dialog while it is visible.
  88      <blockquote><hr>
  89       <b>Note</b>: Everywhere in this document the notion of "window" is equal
  90       to a top-level window in the Java programming language &mdash; in other words
  91       an instance of <code>java.awt.Window</code> or any descendant class.
  92       <hr></blockquote>
  93 
  94     <a id="ModalityTypes"></a>
  95     <h3>Modality types</h3>
  96 
  97     <p>
  98       There are four supported modality types :
  99       </p><ul>
 100         <li>toolkit
 101         </li><li>application
 102         </li><li>document
 103         </li><li>modeless
 104       </li></ul>
 105       A dialog is, by default, modeless.  A modal dialog is, by default,
 106       application-modal.
 107     <ol>
 108       <li><u>Modeless dialogs</u><br>
 109         A modeless dialog doesn't block any windows while visible.
 110       </li><li><u>Document-modal dialogs</u><br>
 111         A document-modal dialog blocks all windows from the same
 112         document except those from its child hierarchy. The document root
 113         is determined as the closest ancestor window without an
 114         owner.


 138       Notes about owners:
 139       </p><ul>
 140         <li>Creating a document-modal dialog without an owner:<br>
 141           Since <code>Dialog</code> is a class derived from
 142           <code>Window</code>, a <code>Dialog</code> instance automatically
 143           becomes the root of the document if it has no owner. Thus, if
 144           such a dialog is document-modal, its scope of blocking is empty
 145           and it behaves the same way as a modeless dialog.
 146         </li><li>Creating an application-modal or toolkit-modal dialog with an
 147           owner:<br>
 148           The scope of blocking for an application- or toolkit-modal
 149           dialog, as opposed to a document-modal dialog, doesn't depend on
 150           its owner. Thus, in this case the only thing that the owner
 151           affects is the Z-order: the dialog always stays on top of its owner.
 152       </li></ul>
 153     <blockquote><hr>
 154       <b>Implementation note</b>: Changing the modality type for a visible
 155       dialog may have no effect until it is hidden and then shown again.
 156       <hr></blockquote>
 157 
 158     <a id="ShowHideBlocking"></a>
 159     <h3>Show/hide blocking</h3>
 160 
 161     <p>
 162       <u>Showing the window or modeless dialog: "F"</u><br>
 163       All the visible modal dialogs are looked through &mdash; if F is from the SB
 164       of one of them, it becomes blocked by it. If there are several such
 165       dialogs, the first shown is used. If no such dialogs exist, F remains
 166       unblocked.
 167     </p><p>
 168       <u>Showing the modal dialog: "M"</u><br>
 169       When modal dialog M is shown, all the visible windows fall into one of
 170       three distinct groups:
 171       <ul>
 172       <li>Blockers of M (modal dialogs that block M and
 173       either are in M's child hierarchy, or are not blocked by M, or have
 174       a greater mode of modality, or block some other blocker of M)
 175       <li>Blocked by M (windows from M's SB that are not blockers and are
 176       not in child hierarchy of any blocker)
 177       <li>All other windows (windows or modeless
 178       dialogs outside M's SB and modal dialogs outside M's SB that do not


 243               <td align="center">-</td>
 244             </tr>
 245           </tbody></table>
 246 <!--        </center> -->
 247       <p>
 248       After the modal dialog is shown, all the windows from its SB are blocked,
 249       except those that block this modal dialog.
 250     </p><p>
 251       <u>Hiding the window or modeless dialog: "F"</u><br>
 252       If F was blocked by any modal dialog M, it becomes unblocked and is
 253       removed from M's blocked windows list.
 254     </p><p>
 255       <u>Hiding the modal dialog: "M"</u><br>
 256       If M was blocked by any other modal dialog, for example, "N",
 257       it becomes unblocked and
 258       is removed from N's blocked windows list. Then, all the windows and dialogs
 259       blocked by M become unblocked, and after that the same checks
 260       (as in Showing the modal dialog: "M")
 261       are performed for each of them in the order they were initially shown.
 262 
 263     <a id="ModalExclusion"></a>
 264     </p><h3>Modal exclusion</h3>
 265 
 266     <p>
 267       There are two modal exclusion types introduced as of JDK 6
 268       </p><ul>
 269         <li>Exclusion from blocking of toolkit-modal dialogs
 270         </li><li>Exclusion from blocking of application-modal dialogs
 271       </li></ul>
 272       By default, a window's modal exclusion property is turned off.
 273       <ol>
 274         <li><u>Application-modal exclusion</u><br>
 275           If a window is application-modal excluded, it is not blocked by any
 276           application-modal dialogs. Also, it is not blocked by document-modal
 277           dialogs from outside of its child hierarchy.
 278         </li><li><u>Toolkit-modal exclusion</u><br>
 279           If a window is toolkit-modal excluded, it is not blocked
 280           by any application- or toolkit-modal dialogs. Also, it is not
 281           blocked by document-modal dialogs from outside of their child hierarchy.
 282       </li></ol>
 283     <blockquote>
 284       <hr>
 285         <b>Implementation note</b>: Changing the modal exclusion type for a visible window
 286         may have no effect until it is hidden and then shown again.
 287     </blockquote>
 288 
 289     <a id="Related"></a>
 290     <h3>Related AWT features</h3>
 291 
 292     <p>
 293       <u>Always-On-Top</u><br>
 294       When a modal dialog that is not always-on-top blocks an always-on-top window,
 295       their relative Z-order is unspecified and platform-dependent.
 296     </p>
 297     <p>
 298       <u>The <code>toFront()</code> and <code>toBack()</code> methods</u><br>
 299       A modal dialog should always be above all its blocked windows. Thus, if a blocked
 300       window is brought to the front, its blocking dialog, if any, is also brought to the
 301       front and remains above the blocked window. Likewise, if a modal dialog is sent to
 302       the back, all of its blocked windows are sent to the back to keep them below the
 303       blocking dialog.
 304     </p>
 305     <p>
 306       <u>Minimizing, maximizing and closing blocked windows</u><br>
 307       When a modal dialog blocks a window, the user may not be able to maximize or
 308       minimize the blocked window&mdash; however, the actual behavior is unspecified
 309       and platform-dependent. In any case, the user can't close the blocked window


 313     </p>
 314     <p>
 315       <u>Blocked windows activations</u><br>
 316       When the user selects a blocked window, it may be brought to the front, along
 317       with the blocking modal dialog which would then become the active window&mdash;
 318       however, the actual behavior is unspecified and platform-dependent.
 319     </p>
 320     <p>
 321       <u>Hiding a modal dialog</u><br>
 322       When the modal dialog that currently has focus is hidden, it is unspecified
 323       and platform-dependent, which other window will become the active window.
 324       Any of the following may become the active window:
 325       <ol>
 326         <li>The owner of the modal dialog - if the owner is unblocked.
 327         </li><li>The <code>Window</code>, which was active before this modal dialog gained
 328         focus - if the owner of the modal dialog is absent or is blocked.
 329       </li></ol>
 330       If the modal dialog to be hidden does not have focus, the active window remains
 331       unchanged.
 332 
 333     <a id="Security"></a>
 334     <h3>Security</h3>
 335 
 336     <p>
 337       A special <code>AWTPermission</code>, <code>"toolkitModality"</code>,
 338       is required to show toolkit-modal
 339       dialogs. This would prevent, for example, blocking a browser or
 340       Java Web Start (JWS) by modal dialogs shown from applets.
 341     </p><p>
 342       The same permission is required to exclude a window from toolkit modality.
 343       This would prevent, for example, a dialog shown from an applet not to be
 344       blocked by a browser's or JWS's modal dialog.
 345 
 346     <a id="PlatformSupport"></a>
 347     </p><h3>Platform support</h3>
 348 
 349     <p>
 350       Two <code>java.awt.Toolkit</code> methods allow you to check whether
 351       the current platform supports specific modality features:
 352       </p><ul>
 353         <li><code>isModalityTypeSupported(modalityType)</code><br>
 354           Returns whether the specified modality type is supported on
 355           the current platform.
 356           If mode "M" is not supported and a dialog is set to M-modal,
 357           it behaves as modeless.
 358         </li>
 359         <li><code>isModalExclusionTypeSupported(modalExclusionType)</code><br>
 360           Returns whether the given modal exclusion type is supported on
 361           the current platform. If exclusion type "E" is not supported
 362           and a window is marked as E-excluded, this has no effect.
 363       </li></ul>
 364 
 365     <a id="Compatibility"></a>
 366     <h3>Compatibility</h3>
 367 
 368     <p>
 369       The default modality type is application-modal. It is used by the API
 370       calls: <code>Dialog.setModal(true)</code>,
 371       <code>Dialog(owner, true)</code>, etc. Prior to JDK 6
 372       the default type was toolkit-modal,
 373       but the only distinction between application- and toolkit-modality is for
 374       applets and applications launched from Java Web Start.
 375 
 376     <a id="Examples"></a>
 377     </p><h3>Examples</h3>
 378 
 379     <table border="0">
 380       <tbody><tr>
 381         <td align="left" >
 382         <ol>
 383           <li>Frame "F" is shown<br>
 384           <li>Document-modal dialog "D<sub>i</sub>" is shown<br>
 385           <li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
 386           <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
 387           <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's in the
 388               same document<br>
 389           </ol>
 390           <br>
 391         </td>
 392         <td align="center">
 393           <img src="modal-example1.gif" alt="Example 1">
 394           <br>
 395         </td>
 396       </tr>


< prev index next >