< prev index next >

src/java.desktop/share/classes/java/awt/Toolkit.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 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


 190      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 191      *            returns true
 192      * @see       #setDynamicLayout(boolean dynamic)
 193      * @see       #isDynamicLayoutActive()
 194      * @see       #getDesktopProperty(String propertyName)
 195      * @see       java.awt.GraphicsEnvironment#isHeadless
 196      * @since     1.4
 197      */
 198     protected boolean isDynamicLayoutSet()
 199         throws HeadlessException {
 200         GraphicsEnvironment.checkHeadless();
 201 
 202         if (this != Toolkit.getDefaultToolkit()) {
 203             return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
 204         } else {
 205             return false;
 206         }
 207     }
 208 
 209     /**
 210      * Returns whether dynamic layout of Containers on resize is
 211      * currently active (both set in program
 212      *( {@code isDynamicLayoutSet()} )
 213      *, and supported
 214      * by the underlying operating system and/or window manager).
 215      * If dynamic layout is currently inactive then Containers
 216      * re-layout their components when resizing is completed. As a result
 217      * the {@code Component.validate()} method will be invoked only
 218      * once per resize.
 219      * If dynamic layout is currently active then Containers
 220      * re-layout their components on every native resize event and
 221      * the {@code validate()} method will be invoked each time.
 222      * The OS/WM support can be queried using
 223      * the getDesktopProperty("awt.dynamicLayoutSupported") method.
 224      *
 225      * @return    true if dynamic layout of Containers on resize is
 226      *            currently active, false otherwise.
 227      * @exception HeadlessException if the GraphicsEnvironment.isHeadless()
 228      *            method returns true




 229      * @see       #setDynamicLayout(boolean dynamic)
 230      * @see       #isDynamicLayoutSet()
 231      * @see       #getDesktopProperty(String propertyName)
 232      * @see       java.awt.GraphicsEnvironment#isHeadless
 233      * @since     1.4
 234      */
 235     public boolean isDynamicLayoutActive()
 236         throws HeadlessException {
 237         GraphicsEnvironment.checkHeadless();
 238 
 239         if (this != Toolkit.getDefaultToolkit()) {
 240             return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
 241         } else {
 242             return false;
 243         }
 244     }
 245 
 246     /**
 247      * Gets the size of the screen.  On systems with multiple displays, the
 248      * primary display is used.  Multi-screen aware display dimensions are


   1 /*
   2  * Copyright (c) 1995, 2016, 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


 190      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 191      *            returns true
 192      * @see       #setDynamicLayout(boolean dynamic)
 193      * @see       #isDynamicLayoutActive()
 194      * @see       #getDesktopProperty(String propertyName)
 195      * @see       java.awt.GraphicsEnvironment#isHeadless
 196      * @since     1.4
 197      */
 198     protected boolean isDynamicLayoutSet()
 199         throws HeadlessException {
 200         GraphicsEnvironment.checkHeadless();
 201 
 202         if (this != Toolkit.getDefaultToolkit()) {
 203             return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
 204         } else {
 205             return false;
 206         }
 207     }
 208 
 209     /**
 210      * Returns whether dynamic layout of Containers on resize is currently
 211      * enabled on the underlying operating system and/or window manager). If the
 212      * platform supports it, {@code setDynamicLayout(boolean)} may be used to
 213      * programmatically enable or disable platform dynamic layout. Regardless of
 214      * whether that toggling is supported, or whether {@code true} or {@code
 215      * false} is specified as an argument, or has never been called at all, this
 216      * method will return the active current platform behavior and which will be
 217      * followed by the JDK in determining layout policy during resizing.
 218      * <p>
 219      * If dynamic layout is currently inactive then Containers re-layout their
 220      * components when resizing is completed. As a result the
 221      * {@code Component.validate()} method will be invoked only once per resize.
 222      * If dynamic layout is currently active then Containers re-layout their
 223      * components on every native resize event and the {@code validate()} method
 224      * will be invoked each time. The OS/WM support can be queried using the
 225      * getDesktopProperty("awt.dynamicLayoutSupported") method. This property
 226      * will reflect the platform capability but is not sufficient to tell if it
 227      * is presently enabled.
 228      *
 229      * @return true if dynamic layout of Containers on resize is currently
 230      *         active, false otherwise.
 231      * @throws HeadlessException if the GraphicsEnvironment.isHeadless() method
 232      *         returns true
 233      * @see #setDynamicLayout(boolean dynamic)
 234      * @see #isDynamicLayoutSet()
 235      * @see #getDesktopProperty(String propertyName)
 236      * @see java.awt.GraphicsEnvironment#isHeadless
 237      * @since 1.4
 238      */
 239     public boolean isDynamicLayoutActive()
 240         throws HeadlessException {
 241         GraphicsEnvironment.checkHeadless();
 242 
 243         if (this != Toolkit.getDefaultToolkit()) {
 244             return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
 245         } else {
 246             return false;
 247         }
 248     }
 249 
 250     /**
 251      * Gets the size of the screen.  On systems with multiple displays, the
 252      * primary display is used.  Multi-screen aware display dimensions are


< prev index next >