src/share/classes/java/awt/Window.java

Print this page




1564      *     <code>exclusionType</code>
1565      * @see java.awt.Dialog.ModalExclusionType
1566      * @see java.awt.Window#getModalExclusionType
1567      * @see java.awt.Toolkit#isModalExclusionTypeSupported
1568      *
1569      * @since 1.6
1570      */
1571     public void setModalExclusionType(Dialog.ModalExclusionType exclusionType) {
1572         if (exclusionType == null) {
1573             exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
1574         }
1575         if (!Toolkit.getDefaultToolkit().isModalExclusionTypeSupported(exclusionType)) {
1576             exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
1577         }
1578         if (modalExclusionType == exclusionType) {
1579             return;
1580         }
1581         if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
1582             SecurityManager sm = System.getSecurityManager();
1583             if (sm != null) {
1584                 sm.checkPermission(SecurityConstants.TOOLKIT_MODALITY_PERMISSION);
1585             }
1586         }
1587         modalExclusionType = exclusionType;
1588 
1589         // if we want on-fly changes, we need to uncomment the lines below
1590         //   and override the method in Dialog to use modalShow() instead
1591         //   of updateChildrenBlocking()
1592  /*
1593         if (isModalBlocked()) {
1594             modalBlocker.unblockWindow(this);
1595         }
1596         Dialog.checkShouldBeBlocked(this);
1597         updateChildrenBlocking();
1598  */
1599     }
1600 
1601     /**
1602      * Returns the modal exclusion type of this window.
1603      *
1604      * @return the modal exclusion type of this window


2112      * order to set the value of this property. If this
2113      * permission is not granted, this method will throw a
2114      * SecurityException, and the current value of the property will
2115      * be left unchanged.
2116      *
2117      * @param alwaysOnTop true if the window should always be above other
2118      *        windows
2119      * @throws SecurityException if the calling thread does not have
2120      *         permission to set the value of always-on-top property
2121      * @see #isAlwaysOnTop
2122      * @see #toFront
2123      * @see #toBack
2124      * @see AWTPermission
2125      * @see #isAlwaysOnTopSupported
2126      * @see Toolkit#isAlwaysOnTopSupported
2127      * @since 1.5
2128      */
2129     public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException {
2130         SecurityManager security = System.getSecurityManager();
2131         if (security != null) {
2132             security.checkPermission(SecurityConstants.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
2133         }
2134 
2135         boolean oldAlwaysOnTop;
2136         synchronized(this) {
2137             oldAlwaysOnTop = this.alwaysOnTop;
2138             this.alwaysOnTop = alwaysOnTop;
2139         }
2140         if (oldAlwaysOnTop != alwaysOnTop ) {
2141             if (isAlwaysOnTopSupported()) {
2142                 WindowPeer peer = (WindowPeer)this.peer;
2143                 synchronized(getTreeLock()) {
2144                     if (peer != null) {
2145                         peer.setAlwaysOnTop(alwaysOnTop);
2146                     }
2147                 }
2148             }
2149             firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop);
2150         }
2151     }
2152 




1564      *     <code>exclusionType</code>
1565      * @see java.awt.Dialog.ModalExclusionType
1566      * @see java.awt.Window#getModalExclusionType
1567      * @see java.awt.Toolkit#isModalExclusionTypeSupported
1568      *
1569      * @since 1.6
1570      */
1571     public void setModalExclusionType(Dialog.ModalExclusionType exclusionType) {
1572         if (exclusionType == null) {
1573             exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
1574         }
1575         if (!Toolkit.getDefaultToolkit().isModalExclusionTypeSupported(exclusionType)) {
1576             exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
1577         }
1578         if (modalExclusionType == exclusionType) {
1579             return;
1580         }
1581         if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
1582             SecurityManager sm = System.getSecurityManager();
1583             if (sm != null) {
1584                 sm.checkPermission(SecurityConstants.AWT.TOOLKIT_MODALITY_PERMISSION);
1585             }
1586         }
1587         modalExclusionType = exclusionType;
1588 
1589         // if we want on-fly changes, we need to uncomment the lines below
1590         //   and override the method in Dialog to use modalShow() instead
1591         //   of updateChildrenBlocking()
1592  /*
1593         if (isModalBlocked()) {
1594             modalBlocker.unblockWindow(this);
1595         }
1596         Dialog.checkShouldBeBlocked(this);
1597         updateChildrenBlocking();
1598  */
1599     }
1600 
1601     /**
1602      * Returns the modal exclusion type of this window.
1603      *
1604      * @return the modal exclusion type of this window


2112      * order to set the value of this property. If this
2113      * permission is not granted, this method will throw a
2114      * SecurityException, and the current value of the property will
2115      * be left unchanged.
2116      *
2117      * @param alwaysOnTop true if the window should always be above other
2118      *        windows
2119      * @throws SecurityException if the calling thread does not have
2120      *         permission to set the value of always-on-top property
2121      * @see #isAlwaysOnTop
2122      * @see #toFront
2123      * @see #toBack
2124      * @see AWTPermission
2125      * @see #isAlwaysOnTopSupported
2126      * @see Toolkit#isAlwaysOnTopSupported
2127      * @since 1.5
2128      */
2129     public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException {
2130         SecurityManager security = System.getSecurityManager();
2131         if (security != null) {
2132             security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
2133         }
2134 
2135         boolean oldAlwaysOnTop;
2136         synchronized(this) {
2137             oldAlwaysOnTop = this.alwaysOnTop;
2138             this.alwaysOnTop = alwaysOnTop;
2139         }
2140         if (oldAlwaysOnTop != alwaysOnTop ) {
2141             if (isAlwaysOnTopSupported()) {
2142                 WindowPeer peer = (WindowPeer)this.peer;
2143                 synchronized(getTreeLock()) {
2144                     if (peer != null) {
2145                         peer.setAlwaysOnTop(alwaysOnTop);
2146                     }
2147                 }
2148             }
2149             firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop);
2150         }
2151     }
2152