1 /*
2 * Copyright (c) 1998, 2017, 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
2209 if (laf == null || laf != UIManager.getLookAndFeel()) {
2210 dispose();
2211 return;
2212 }
2213 UIDefaults defaults = UIManager.getLookAndFeelDefaults();
2214 boolean lafCond = SwingUtilities2.isLocalDisplay();
2215 SwingUtilities2.putAATextInfo(lafCond, defaults);
2216 updateUI();
2217 }
2218
2219 void dispose() {
2220 Toolkit tk = Toolkit.getDefaultToolkit();
2221 tk.removePropertyChangeListener(key, this);
2222 }
2223
2224 /**
2225 * Updates the UI of the passed in window and all its children.
2226 */
2227 private static void updateWindowUI(Window window) {
2228 SwingUtilities.updateComponentTreeUI(window);
2229 Window ownedWins[] = window.getOwnedWindows();
2230 for (Window w : ownedWins) {
2231 updateWindowUI(w);
2232 }
2233 }
2234
2235 /**
2236 * Updates the UIs of all the known Frames.
2237 */
2238 private static void updateAllUIs() {
2239 Frame appFrames[] = Frame.getFrames();
2240 for (Frame frame : appFrames) {
2241 updateWindowUI(frame);
2242 }
2243 }
2244
2245 /**
2246 * Indicates if an updateUI call is pending.
2247 */
2248 private static boolean updatePending;
2249
2250 /**
2251 * Sets whether or not an updateUI call is pending.
2252 */
2253 private static synchronized void setUpdatePending(boolean update) {
2254 updatePending = update;
2255 }
2256
2257 /**
2258 * Returns true if a UI update is pending.
2259 */
|
1 /*
2 * Copyright (c) 1998, 2018, 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
2209 if (laf == null || laf != UIManager.getLookAndFeel()) {
2210 dispose();
2211 return;
2212 }
2213 UIDefaults defaults = UIManager.getLookAndFeelDefaults();
2214 boolean lafCond = SwingUtilities2.isLocalDisplay();
2215 SwingUtilities2.putAATextInfo(lafCond, defaults);
2216 updateUI();
2217 }
2218
2219 void dispose() {
2220 Toolkit tk = Toolkit.getDefaultToolkit();
2221 tk.removePropertyChangeListener(key, this);
2222 }
2223
2224 /**
2225 * Updates the UI of the passed in window and all its children.
2226 */
2227 private static void updateWindowUI(Window window) {
2228 SwingUtilities.updateComponentTreeUI(window);
2229 Window[] ownedWins = window.getOwnedWindows();
2230 for (Window w : ownedWins) {
2231 updateWindowUI(w);
2232 }
2233 }
2234
2235 /**
2236 * Updates the UIs of all the known Frames.
2237 */
2238 private static void updateAllUIs() {
2239 Frame[] appFrames = Frame.getFrames();
2240 for (Frame frame : appFrames) {
2241 updateWindowUI(frame);
2242 }
2243 }
2244
2245 /**
2246 * Indicates if an updateUI call is pending.
2247 */
2248 private static boolean updatePending;
2249
2250 /**
2251 * Sets whether or not an updateUI call is pending.
2252 */
2253 private static synchronized void setUpdatePending(boolean update) {
2254 updatePending = update;
2255 }
2256
2257 /**
2258 * Returns true if a UI update is pending.
2259 */
|