src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java

Print this page


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


  85     /**
  86      * Sets whether or not an updateUI call is pending.
  87      */
  88     private static synchronized void setUpdatePending(boolean update) {
  89         updatePending = update;
  90     }
  91 
  92     /**
  93      * Returns true if a UI update is pending.
  94      */
  95     private static synchronized boolean isUpdatePending() {
  96         return updatePending;
  97     }
  98 
  99     /**
 100      * Updates the UIs of all the known Frames.
 101      */
 102     private static void updateAllUIs() {
 103         // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
 104         // Note: Change the package test if this class is moved to a different package.
 105         Class uiClass = UIManager.getLookAndFeel().getClass();
 106         if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
 107             XPStyle.invalidateStyle();
 108         }
 109         Frame appFrames[] = Frame.getFrames();
 110         for (Frame appFrame : appFrames) {
 111             updateWindowUI(appFrame);
 112         }
 113     }
 114 
 115     /**
 116      * Updates the UI of the passed in window and all its children.
 117      */
 118     private static void updateWindowUI(Window window) {
 119         SwingUtilities.updateComponentTreeUI(window);
 120         Window ownedWins[] = window.getOwnedWindows();
 121         for (Window ownedWin : ownedWins) {
 122             updateWindowUI(ownedWin);
 123         }
 124     }
 125 


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


  85     /**
  86      * Sets whether or not an updateUI call is pending.
  87      */
  88     private static synchronized void setUpdatePending(boolean update) {
  89         updatePending = update;
  90     }
  91 
  92     /**
  93      * Returns true if a UI update is pending.
  94      */
  95     private static synchronized boolean isUpdatePending() {
  96         return updatePending;
  97     }
  98 
  99     /**
 100      * Updates the UIs of all the known Frames.
 101      */
 102     private static void updateAllUIs() {
 103         // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
 104         // Note: Change the package test if this class is moved to a different package.
 105         Class<?> uiClass = UIManager.getLookAndFeel().getClass();
 106         if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
 107             XPStyle.invalidateStyle();
 108         }
 109         Frame appFrames[] = Frame.getFrames();
 110         for (Frame appFrame : appFrames) {
 111             updateWindowUI(appFrame);
 112         }
 113     }
 114 
 115     /**
 116      * Updates the UI of the passed in window and all its children.
 117      */
 118     private static void updateWindowUI(Window window) {
 119         SwingUtilities.updateComponentTreeUI(window);
 120         Window ownedWins[] = window.getOwnedWindows();
 121         for (Window ownedWin : ownedWins) {
 122             updateWindowUI(ownedWin);
 123         }
 124     }
 125