Java Code Examples for java.awt.peer.WindowPeer#updateAlwaysOnTopState()
The following examples show how to use
java.awt.peer.WindowPeer#updateAlwaysOnTopState() .
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 jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 2
Source File: Window.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 3
Source File: Window.java From jdk-1.7-annotated with Apache License 2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to <code>false</code>. * * <p> When this method is called on a window with a value of * <code>true</code>, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to <code>true</code> but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * <code>false</code> the always-on-top state is set to normal. The * window remains in the top-most position but it`s z-order can be * changed as for any other window. Calling this method with a value * of <code>false</code> on a window that has a normal state has no * effect. Setting the always-on-top state to false has no effect on * the relative z-order of the windows if there are no other * always-on-top windows. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported by the toolkit or for this window, calling this * method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } }
Example 4
Source File: Window.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 5
Source File: Window.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 6
Source File: Window.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 7
Source File: Window.java From Java8CN with Apache License 2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 8
Source File: Window.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 9
Source File: Window.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 10
Source File: Window.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 11
Source File: Window.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 12
Source File: Window.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 13
Source File: Window.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 14
Source File: Window.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 15
Source File: Window.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 16
Source File: Window.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } setOwnedWindowsAlwaysOnTop(alwaysOnTop); }
Example 17
Source File: Window.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } for (WeakReference<Window> ref : ownedWindowList) { Window window = ref.get(); if (window != null) { try { window.setAlwaysOnTop(alwaysOnTop); } catch (SecurityException ignore) { } } } }
Example 18
Source File: Window.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
/** * Sets whether this window should always be above other windows. If * there are multiple always-on-top windows, their relative order is * unspecified and platform dependent. * <p> * If some other window is already always-on-top then the * relative order between these windows is unspecified (depends on * platform). No window can be brought to be over the always-on-top * window except maybe another always-on-top window. * <p> * All windows owned by an always-on-top window inherit this state and * automatically become always-on-top. If a window ceases to be * always-on-top, the windows that it owns will no longer be * always-on-top. When an always-on-top window is sent {@link #toBack * toBack}, its always-on-top state is set to {@code false}. * * <p> When this method is called on a window with a value of * {@code true}, and the window is visible and the platform * supports always-on-top for this window, the window is immediately * brought forward, "sticking" it in the top-most position. If the * window isn`t currently visible, this method sets the always-on-top * state to {@code true} but does not bring the window forward. * When the window is later shown, it will be always-on-top. * * <p> When this method is called on a window with a value of * {@code false} the always-on-top state is set to normal. It may also * cause an unspecified, platform-dependent change in the z-order of * top-level windows, but other always-on-top windows will remain in * top-most position. Calling this method with a value of {@code false} * on a window that has a normal state has no effect. * * <p><b>Note</b>: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the * current platform, use {@link Toolkit#isAlwaysOnTopSupported()} and * {@link Window#isAlwaysOnTopSupported()}. If always-on-top mode * isn't supported for this window or this window's toolkit does not * support always-on-top windows, calling this method has no effect. * <p> * If a SecurityManager is installed, the calling thread must be * granted the AWTPermission "setWindowAlwaysOnTop" in * order to set the value of this property. If this * permission is not granted, this method will throw a * SecurityException, and the current value of the property will * be left unchanged. * * @param alwaysOnTop true if the window should always be above other * windows * @throws SecurityException if the calling thread does not have * permission to set the value of always-on-top property * * @see #isAlwaysOnTop * @see #toFront * @see #toBack * @see AWTPermission * @see #isAlwaysOnTopSupported * @see #getToolkit * @see Toolkit#isAlwaysOnTopSupported * @since 1.5 */ public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); } boolean oldAlwaysOnTop; synchronized(this) { oldAlwaysOnTop = this.alwaysOnTop; this.alwaysOnTop = alwaysOnTop; } if (oldAlwaysOnTop != alwaysOnTop ) { if (isAlwaysOnTopSupported()) { WindowPeer peer = (WindowPeer)this.peer; synchronized(getTreeLock()) { if (peer != null) { peer.updateAlwaysOnTopState(); } } } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } for (WeakReference<Window> ref : ownedWindowList) { Window window = ref.get(); if (window != null) { try { window.setAlwaysOnTop(alwaysOnTop); } catch (SecurityException ignore) { } } } }