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 23 * questions. 24 */ 25 26/** 27 * Provides user interface objects built according to the cross-platform Nimbus 28 * look and feel. 29 * <p> 30 * Nimbus uses instances of the {@link javax.swing.Painter} interface to paint 31 * components. With each Swing component it associates a foreground and a 32 * background {@code Painter}, and there may be several painters for different 33 * component states. 34 * <p> 35 * Nimbus allows customizing many of its properties, including painters, by 36 * altering the {@link javax.swing.UIDefaults} table. Here's an example: 37 * <pre> 38 * UIManager.put("ProgressBar.tileWidth", myTileWidth); 39 * UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter); 40 * UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter); 41 * </pre> 42 * <p> 43 * Per-component customization is also possible. When rendering a component, 44 * Nimbus checks its client property named "Nimbus.Overrides". The value of this 45 * property should be an instance of {@code UIDefaults}. Settings from that 46 * table override the UIManager settings, but for that particular component 47 * instance only. An optional client property, 48 * "Nimbus.Overrides.InheritDefaults" of type Boolean, specifies whether the 49 * overriding settings should be merged with default ones ({@code true}), or 50 * replace them ({@code false}). By default they are merged: 51 * <pre> 52 * JProgressBar bar = new JProgressBar(); 53 * UIDefaults overrides = new UIDefaults(); 54 * overrides.put("ProgressBar.cycleTime", 330); 55 * ... 56 * bar.putClientProperty("Nimbus.Overrides", overrides); 57 * bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false); 58 * </pre> 59 * <p> 60 * Colors in Nimbus are derived from a core set of 61 * <a href="doc-files/properties.html#primaryColors">primary colors</a>. There 62 * are also 63 * <a href="doc-files/properties.html#secondaryColors">secondary colors</a>, 64 * which are derived from primary ones, but serve themselves as base colors for 65 * other derived colors. The derivation mechanism allows for runtime 66 * customization, i.e. if a primary or secondary color is changed, all colors 67 * that are derived from it are automatically updated. The method 68 * {@link javax.swing.plaf.nimbus.NimbusLookAndFeel#getDerivedColor(java.lang.String, float, float, float, int, boolean)} 69 * may be used to create a derived color. 70 * <p> 71 * These classes are designed to be used while the corresponding 72 * {@code LookAndFeel} class has been installed 73 * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>). 74 * Using them while a different {@code LookAndFeel} is installed may produce 75 * unexpected results, including exceptions. Additionally, changing the 76 * {@code LookAndFeel} maintained by the {@code UIManager} without updating the 77 * corresponding {@code ComponentUI} of any {@code JComponent}s may also produce 78 * unexpected results, such as the wrong colors showing up, and is generally not 79 * encouraged. 80 * <p> 81 * <strong>Note:</strong> 82 * Most of the Swing API is <em>not</em> thread safe. For details, see 83 * <a 84 * href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html" 85 * target="_top">Concurrency in Swing</a>, 86 * a section in 87 * <em><a href="http://docs.oracle.com/javase/tutorial/" 88 * target="_top">The Java Tutorial</a></em>. 89 * 90 * @since 1.7 91 * @serial exclude 92 */ 93package javax.swing.plaf.nimbus; 94